Re: [PATCH 3/6] ceph: return the correct dentry on mkdir

2025-02-24 Thread Jeff Layton
err = PTR_ERR(req); > > + ret = ERR_CAST(req); > > goto out; > > } > > > > mode |= S_IFDIR; > > req->r_new_inode = ceph_new_inode(dir, dentry, &mode, &as_ctx); > > if (IS_ERR(req->r_new_inode)) { > &

Re: [PATCH 6/6] VFS: Change vfs_mkdir() to return the dentry.

2025-02-21 Thread Jeff Layton
if (IS_ERR(dentry)) > + err = PTR_ERR(dentry); > + else if (d_is_negative(dentry)) > + err = -ENOENT; > + if (!err && dentry != d) > + ksmbd_vfs_inherit_owner(work, d_inode(path.dentry), > d_inode(dentry)); > > -out_err: > done_path_create(&path, dentry); > if (err) > pr_err("mkdir(%s): creation failed (err:%d)\n", name, err); > diff --git a/fs/xfs/scrub/orphanage.c b/fs/xfs/scrub/orphanage.c > index c287c755f2c5..3537f3cca6d5 100644 > --- a/fs/xfs/scrub/orphanage.c > +++ b/fs/xfs/scrub/orphanage.c > @@ -167,10 +167,11 @@ xrep_orphanage_create( >* directory to control access to a file we put in here. >*/ > if (d_really_is_negative(orphanage_dentry)) { > - error = vfs_mkdir(&nop_mnt_idmap, root_inode, orphanage_dentry, > - 0750); > - if (error) > - goto out_dput_orphanage; > + orphanage_dentry = vfs_mkdir(&nop_mnt_idmap, root_inode, > + orphanage_dentry, 0750); > + error = PTR_ERR(orphanage_dentry); > + if (IS_ERR(orphanage_dentry)) > + goto out_unlock_root; > } > > /* Not a directory? Bail out. */ > diff --git a/include/linux/fs.h b/include/linux/fs.h > index 8f4fbecd40fc..eaad8e31c0d4 100644 > --- a/include/linux/fs.h > +++ b/include/linux/fs.h > @@ -1971,8 +1971,8 @@ bool inode_owner_or_capable(struct mnt_idmap *idmap, > */ > int vfs_create(struct mnt_idmap *, struct inode *, > struct dentry *, umode_t, bool); > -int vfs_mkdir(struct mnt_idmap *, struct inode *, > - struct dentry *, umode_t); > +struct dentry *vfs_mkdir(struct mnt_idmap *, struct inode *, > + struct dentry *, umode_t); > int vfs_mknod(struct mnt_idmap *, struct inode *, struct dentry *, >umode_t, dev_t); > int vfs_symlink(struct mnt_idmap *, struct inode *, Nice cleanup in the vfs_mkdir() callers. Reviewed-by: Jeff Layton

Re: [PATCH 3/6] ceph: return the correct dentry on mkdir

2025-02-21 Thread Jeff Layton
; will even have an inode attached if it got replaced by an disconnected one in the dcache? > ceph_init_inode_acls(d_inode(dentry), &as_ctx); > else > d_drop(dentry); > ceph_release_acl_sec_ctx(&as_ctx); > - return ERR_PTR(err); > + if (err) > + return ERR_PTR(err); > + return ret; > } > > static int ceph_link(struct dentry *old_dentry, struct inode *dir, -- Jeff Layton

Re: [PATCH 4/6] fuse: return correct dentry for ->mkdir

2025-02-21 Thread Jeff Layton
> inode->i_mode); > - if (!err) > + de = create_new_entry(&invalid_mnt_idmap, fm, &args, newdir, newent, > inode->i_mode); > + if (!IS_ERR(de)) { > + if (de) > + dput(de); > + de = NULL; > fuse_update_ctime_in_cache(inode); > - else if (err == -EINTR) > + } else if (PTR_ERR(de) == -EINTR) > fuse_invalidate_attr(inode); > > - return err; > + return PTR_ERR(de); > } > > static void fuse_fillattr(struct mnt_idmap *idmap, struct inode *inode, Pretty straightforward. Reviewed-by: Jeff Layton

Re: [PATCH 2/6] hostfs: store inode in dentry after mkdir if possible.

2025-02-21 Thread Jeff Layton
ry); > + dentry = d_splice_alias(inode, dentry); > + } > __putname(file); > - return ERR_PTR(err); > + return dentry; > } > > static int hostfs_rmdir(struct inode *ino, struct dentry *dentry) Reviewed-by: Jeff Layton

[PATCH v2 88/89] fs: switch timespec64 fields in inode to discrete integers

2023-10-04 Thread Jeff Layton
This shaves 8 bytes off struct inode with a garden-variety Fedora Kconfig. Signed-off-by: Jeff Layton --- include/linux/fs.h | 53 ++ 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/include/linux/fs.h b/include/linux/fs.h index

[PATCH v2 87/89] fs: rename inode i_atime and i_mtime fields

2023-10-04 Thread Jeff Layton
Rename these two fields to discourage direct access (and to help ensure that we mop up any leftover direct accesses). Signed-off-by: Jeff Layton --- include/linux/fs.h | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/include/linux/fs.h b/include/linux

[PATCH v2 00/89] fs: new accessor methods for inode atime and mtime

2023-10-04 Thread Jeff Layton
re feeling lucky). Jeff Layton (89): fs: new accessor methods for atime and mtime fs: convert core infrastructure to new timestamp accessors spufs: convert to new timestamp accessors hypfs: convert to new timestamp accessors android: convert to new timestamp accessors char: conv

[PATCH v2 01/89] fs: new accessor methods for atime and mtime

2023-10-04 Thread Jeff Layton
atime and mtime that mirror the accessors for the ctime. Signed-off-by: Jeff Layton --- fs/libfs.c | 41 -- include/linux/fs.h | 85 +++--- 2 files changed, 102 insertions(+), 24 deletions(-) diff --git a/fs/libfs.c b/fs

[PATCH v2 02/89] fs: convert core infrastructure to new timestamp accessors

2023-10-04 Thread Jeff Layton
Convert the core vfs code to use the new timestamp accessor functions. Signed-off-by: Jeff Layton --- fs/attr.c| 4 ++-- fs/bad_inode.c | 2 +- fs/binfmt_misc.c | 2 +- fs/inode.c | 35 +-- fs/nsfs.c| 2 +- fs/pipe.c| 2 +- fs

[PATCH v2 89/89] fs: move i_generation into new hole created after timestamp conversion

2023-10-04 Thread Jeff Layton
i_fsnotify_mask in my setup. Suggested-by: Amir Goldstein Signed-off-by: Jeff Layton --- include/linux/fs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/fs.h b/include/linux/fs.h index 485b5e21c8e5..686c9f33e725 100644 --- a/include/linux/fs.h +++ b/include/linux

[PATCH v2 43/89] hostfs: convert to new timestamp accessors

2023-10-04 Thread Jeff Layton
Convert to using the new inode timestamp accessor functions. Signed-off-by: Jeff Layton --- fs/hostfs/hostfs_kern.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index dc5a5cea5fae..ea87f24c6c3f 100644 --- a/fs

Re: [PATCH 86/87] fs: switch timespec64 fields in inode to discrete integers

2023-09-29 Thread Jeff Layton
On Thu, 2023-09-28 at 07:05 -0400, Jeff Layton wrote: > This shaves 8 bytes off struct inode, according to pahole. > > Signed-off-by: Jeff Layton > --- > include/linux/fs.h | 32 +++- > 1 file changed, 23 insertions(+), 9 deletions(-) > > di

Re: [PATCH 87/87] fs: move i_blocks up a few places in struct inode

2023-09-29 Thread Jeff Layton
On Thu, 2023-09-28 at 10:41 -0700, Linus Torvalds wrote: > On Thu, 28 Sept 2023 at 04:06, Jeff Layton wrote: > > > > Move i_blocks up above the i_lock, which moves the new 4 byte hole to > > just after the timestamps, without changing the size of the structure. >

Re: [PATCH 86/87] fs: switch timespec64 fields in inode to discrete integers

2023-09-29 Thread Jeff Layton
On Thu, 2023-09-28 at 10:19 -0700, Darrick J. Wong wrote: > On Thu, Sep 28, 2023 at 01:06:03PM -0400, Jeff Layton wrote: > > On Thu, 2023-09-28 at 11:48 -0400, Arnd Bergmann wrote: > > > On Thu, Sep 28, 2023, at 07:05, Jeff Layton wrote: > > > > This shaves 8 bytes

[PATCH 00/87] fs: new accessor methods for atime and mtime

2023-09-29 Thread Jeff Layton
this conversion was done with coccinelle, with the rest done by hand with vim. Jeff Layton (87): fs: new accessor methods for atime and mtime fs: convert core infrastructure to new {a,m}time accessors arch/powerpc/platforms/cell/spufs: convert to new inode {a,m}time accessors arch/s390/

Re: [PATCH 86/87] fs: switch timespec64 fields in inode to discrete integers

2023-09-29 Thread Jeff Layton
. FWIW, I'm planning to do a v2 patchbomb early next week, with the changes that Chuck suggested (specific helpers for fetching the _sec and _nsec fields). For now, I'll drop the change from timespec64 to discrete fields. We can do that in a separate follow-on set. -- Jeff L

Re: [PATCH 86/87] fs: switch timespec64 fields in inode to discrete integers

2023-09-29 Thread Jeff Layton
On Thu, 2023-09-28 at 11:48 -0400, Arnd Bergmann wrote: > On Thu, Sep 28, 2023, at 07:05, Jeff Layton wrote: > > This shaves 8 bytes off struct inode, according to pahole. > > > > Signed-off-by: Jeff Layton > > FWIW, this is similar to the approach that Dee

[PATCH 87/87] fs: move i_blocks up a few places in struct inode

2023-09-29 Thread Jeff Layton
timestamps, without changing the size of the structure. Signed-off-by: Jeff Layton --- include/linux/fs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/fs.h b/include/linux/fs.h index de902ff2938b..3e0fe0f52e7c 100644 --- a/include/linux/fs.h +++ b/include/linux

Re: [PATCH 87/87] fs: move i_blocks up a few places in struct inode

2023-09-29 Thread Jeff Layton
On Thu, 2023-09-28 at 14:35 +0300, Amir Goldstein wrote: > On Thu, Sep 28, 2023 at 2:06 PM Jeff Layton wrote: > > > > The recent change to use discrete integers instead of struct timespec64 > > in struct inode shaved 8 bytes off of it, but it also moves the i_lock > >

[PATCH 86/87] fs: switch timespec64 fields in inode to discrete integers

2023-09-29 Thread Jeff Layton
This shaves 8 bytes off struct inode, according to pahole. Signed-off-by: Jeff Layton --- include/linux/fs.h | 32 +++- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/include/linux/fs.h b/include/linux/fs.h index 831657011036..de902ff2938b 100644

[PATCH 01/87] fs: new accessor methods for atime and mtime

2023-09-29 Thread Jeff Layton
atime and mtime that mirror the accessors for the ctime. Signed-off-by: Jeff Layton --- fs/libfs.c | 13 + include/linux/fs.h | 42 ++ 2 files changed, 55 insertions(+) diff --git a/fs/libfs.c b/fs/libfs.c index 37f2d34ee090

[PATCH 85/87] fs: rename i_atime and i_mtime fields to __i_atime and __i_mtime

2023-09-29 Thread Jeff Layton
Make it clear that these fields are private now, and that the accessors should be used instead. Signed-off-by: Jeff Layton --- include/linux/fs.h | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/linux/fs.h b/include/linux/fs.h index 12d247b82aa0

[PATCH 42/87] fs/hostfs: convert to new inode {a,m}time accessors

2023-09-28 Thread Jeff Layton
Signed-off-by: Jeff Layton --- fs/hostfs/hostfs_kern.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index dc5a5cea5fae..ea87f24c6c3f 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c @@ -513,10

Re: [PATCH v2 08/92] fs: new helper: simple_rename_timestamp

2023-09-09 Thread Jeff Layton
On Wed, 2023-08-30 at 01:19 +0100, Al Viro wrote: > On Wed, Jul 05, 2023 at 02:58:11PM -0400, Jeff Layton wrote: > > > + * POSIX mandates that the old and new parent directories have their ctime > > and > > + * mtime updated, and that inodes of @old_dentry and @new_de

[PATCH v2 50/92] hostfs: convert to ctime accessor functions

2023-07-05 Thread Jeff Layton
In later patches, we're going to change how the inode's ctime field is used. Switch to using accessor functions instead of raw accesses of inode->i_ctime. Signed-off-by: Jeff Layton --- fs/hostfs/hostfs_kern.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --gi

[PATCH 37/79] hostfs: switch to new ctime accessors

2023-06-21 Thread Jeff Layton
In later patches, we're going to change how the ctime.tv_nsec field is utilized. Switch to using accessor functions instead of raw accesses of inode->i_ctime. Signed-off-by: Jeff Layton --- fs/hostfs/hostfs_kern.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/f