vfs: recall-only directory delegations for knfsd
Subsystems (16)
Jeff Layton
maintainerv3 cover vfs: recall-only directory delegations for knfsd
Behold, another version of directory delegations. This version contains support for recall-only delegations. Support for CB_NOTIFY will be forthcoming (once the client-side patches have caught up).
This main differences in this version are bugfixes, but the last patch adds a more formal API for userland to request a delegation. That support is optional. We can drop it and the rest of the series should be fine.
My main interest in making delegations available to userland is to allow testing this support without nfsd. I have an xfstest ready to submit for this if that support looks acceptable. If it is, then I'll also plan to submit an update for fcntl(2).
Christian, Chuck mentioned he was fine with you merging the nfsd bits too, if you're willing to take the whole pile.
Thanks!
Jeff
---
Changes in v3:
- Fix potential nfsd_file refcount leaks on GET_DIR_DELEGATION error
- Add missing parent dir deleg break in vfs_symlink()
- Add F_SETDELEG/F_GETDELEG support to fcntl()
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- handle lease conflict resolution inside of nfsd
- drop the lm_may_setlease lock_manager operation
- just add extra argument to vfs_create() instead of creating wrapper
- don't allocate fsnotify_mark for open directories
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Jeff Layton (13):
filelock: push the S_ISREG check down to ->setlease handlers
vfs: add try_break_deleg calls for parents to vfs_{link,rename,unlink}
vfs: allow mkdir to wait for delegation break on parent
vfs: allow rmdir to wait for delegation break on parent
vfs: break parent dir delegations in open(..., O_CREAT) codepath
vfs: make vfs_create break delegations on parent directory
vfs: make vfs_mknod break delegations on parent directory
vfs: make vfs_symlink break delegations on parent dir
filelock: lift the ban on directory leases in generic_setlease
nfsd: allow filecache to hold S_IFDIR files
nfsd: allow DELEGRETURN on directories
nfsd: wire up GET_DIR_DELEGATION handling
vfs: expose delegation support to userland
drivers/base/devtmpfs.c | 6 +- fs/cachefiles/namei.c | 2 +- fs/ecryptfs/inode.c | 10 +-- fs/fcntl.c | 9 +++ fs/fuse/dir.c | 1 + fs/init.c | 6 +- fs/locks.c | 68 +++++++++++++++----- fs/namei.c | 150 +++++++++++++++++++++++++++++++++++---------- fs/nfs/nfs4file.c | 2 + fs/nfsd/filecache.c | 57 ++++++++++++----- fs/nfsd/filecache.h | 2 + fs/nfsd/nfs3proc.c | 2 +- fs/nfsd/nfs4proc.c | 22 ++++++- fs/nfsd/nfs4recover.c | 6 +- fs/nfsd/nfs4state.c | 103 ++++++++++++++++++++++++++++++- fs/nfsd/state.h | 5 ++ fs/nfsd/vfs.c | 16 ++--- fs/nfsd/vfs.h | 2 +- fs/open.c | 2 +- fs/overlayfs/overlayfs.h | 10 +-- fs/smb/client/cifsfs.c | 3 + fs/smb/server/vfs.c | 8 +-- fs/xfs/scrub/orphanage.c | 2 +- include/linux/filelock.h | 12 ++++ include/linux/fs.h | 13 ++-- include/uapi/linux/fcntl.h | 10 +++ net/unix/af_unix.c | 2 +- 27 files changed, 425 insertions(+), 106 deletions(-)
---
base-commit: d2ced3cadfab04c7e915adf0a73c53fcf1642719
change-id: 20251013-dir-deleg-ro-d0fe19823b21
Best regards,
Signature · 1 line
Jeff Layton <[email protected]>
Jeff Layton
maintainerPATCH v3 1/13 filelock: push the S_ISREG check down to ->setlease handlers
When nfsd starts requesting directory delegations, setlease handlers may see requests for leases on directories. Push the !S_ISREG check down into the non-trivial setlease handlers, so we can selectively enable them where they're supported.
FUSE is special: It's the only filesystem that supports atomic_open and allows kernel-internal leases. atomic_open is issued when the VFS doesn't know the state of the dentry being opened. If the file doesn't exist, it may be created, in which case the dir lease should be broken.
The existing kernel-internal lease implementation has no provision for this. Ensure that we don't allow directory leases by default going forward by explicitly disabling them there.
--- fs/fuse/dir.c | 1 + fs/locks.c | 5 +++-- fs/nfs/nfs4file.c | 2 ++ fs/smb/client/cifsfs.c | 3 +++ 4 files changed, 9 insertions(+), 2 deletions(-)
fs/fuse/dir.c +1 -0
@@ -2230,6 +2230,7 @@ static const struct file_operations fuse_dir_operations = { .fsync = fuse_dir_fsync, .unlocked_ioctl = fuse_dir_ioctl, .compat_ioctl = fuse_dir_compat_ioctl, + .setlease = simple_nosetlease, };static const struct inode_operations fuse_common_inode_operations = {
fs/locks.c +3 -2
@@ -1929,6 +1929,9 @@ static int generic_delete_lease(struct file *filp, void *owner)int generic_setlease (struct file *filp,int arg,struct file_lease **flp,void **priv) { +if (!S_ISREG (file_inode (filp)->i_mode)) +return -EINVAL ; +switch (arg) {case F_UNLCK :return generic_delete_lease (filp, *priv);
@@ -2018,8 +2021,6 @@ vfs_setlease(struct file *filp, int arg, struct file_lease **lease, void **priv)if ((!vfsuid_eq_kuid (vfsuid,current_fsuid ())) && !capable (CAP_LEASE ))return -EACCES ; -if (!S_ISREG (inode->i_mode)) -return -EINVAL ; error =security_file_lock (filp, arg);if (error)return error;
fs/nfs/nfs4file.c +2 -0
@@ -431,6 +431,8 @@ void nfs42_ssc_unregister_ops(void)static int nfs4_setlease (struct file *file,int arg,struct file_lease **lease,void **priv) { +if (!S_ISREG (file_inode (file)->i_mode)) +return -EINVAL ;return nfs4_proc_setlease (file, arg, lease, priv); }
fs/smb/client/cifsfs.c +3 -0
@@ -1149,6 +1149,9 @@ cifs_setlease(struct file *file, int arg, struct file_lease **lease, void **privstruct inode *inode =file_inode (file);struct cifsFileInfo *cfile = file->private_data; +if (!S_ISREG (inode->i_mode)) +return -EINVAL ; +/* Check if file is oplocked if this is request for new lease */ if (arg == F_UNLCK || ((arg == F_RDLCK) && CIFS_CACHE_READ(CIFS_I(inode))) ||
Signature · 1 line
2.51.0
Re: [PATCH v3 01/13] filelock: push the S_ISREG check down to ->setlease handlers
Quoted 10 lines · Jeff Layton
When nfsd starts requesting directory delegations, setlease handlers may see requests for leases on directories. Push the !S_ISREG check down into the non-trivial setlease handlers, so we can selectively enable them where they're supported.
FUSE is special: It's the only filesystem that supports
atomic_openand allows kernel-internal leases.atomic_openis issued when the VFS doesn't know the state of the dentry being opened. If the file doesn't exist, it may be created, in which case the dir lease should be broken.
Quoted 6 lines
The existing kernel-internal lease implementation has no provision for this. Ensure that we don't allow directory leases by default going forward by explicitly disabling them there.
Reviewed-by NeilBrown <[email protected]>Signed-off-by Jeff Layton <[email protected]>
Looks good. Feel free to add:
Honza
Quoted 73 lines
--- fs/fuse/dir.c | 1 + fs/locks.c | 5 +++-- fs/nfs/nfs4file.c | 2 ++ fs/smb/client/cifsfs.c | 3 +++ 4 files changed, 9 insertions(+), 2 deletions(-)fs/fuse/dir.c +1
-0@@ -2230,6 +2230,7 @@ static const struct file_operations fuse_dir_operations = { .fsync = fuse_dir_fsync, .unlocked_ioctl = fuse_dir_ioctl, .compat_ioctl = fuse_dir_compat_ioctl, + .setlease = simple_nosetlease, };static const struct inode_operations fuse_common_inode_operations = {fs/locks.c +3
-2@@ -1929,6 +1929,9 @@ static int generic_delete_lease(struct file *filp, void *owner)int generic_setlease (struct file *filp,int arg,struct file_lease **flp,void **priv) { +if (!S_ISREG (file_inode (filp)->i_mode)) +return -EINVAL ; +switch (arg) {case F_UNLCK :return generic_delete_lease (filp, *priv);@@ -2018,8 +2021,6 @@ vfs_setlease(struct file *filp, int arg, struct file_lease **lease, void **priv)if ((!vfsuid_eq_kuid (vfsuid,current_fsuid ())) && !capable (CAP_LEASE ))return -EACCES ; -if (!S_ISREG (inode->i_mode)) -return -EINVAL ; error =security_file_lock (filp, arg);if (error)return error;fs/nfs/nfs4file.c +2
-0@@ -431,6 +431,8 @@ void nfs42_ssc_unregister_ops(void)static int nfs4_setlease (struct file *file,int arg,struct file_lease **lease,void **priv) { +if (!S_ISREG (file_inode (file)->i_mode)) +return -EINVAL ;return nfs4_proc_setlease (file, arg, lease, priv); }fs/smb/client/cifsfs.c +3
-0@@ -1149,6 +1149,9 @@ cifs_setlease(struct file *file, int arg, struct file_lease **lease, void **privstruct inode *inode =file_inode (file);struct cifsFileInfo *cfile = file->private_data; +if (!S_ISREG (inode->i_mode)) +return -EINVAL ; +/* Check if file is oplocked if this is request for new lease */ if (arg == F_UNLCK || ((arg == F_RDLCK) && CIFS_CACHE_READ(CIFS_I(inode))) ||Signature · 2 lines
-- 2.51.0
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Jeff Layton
maintainerPATCH v3 2/13 vfs: add try_break_deleg calls for parents to vfs_{link,rename,unlink}
In reply to Jeff LaytonIn order to add directory delegation support, we need to break delegations on the parent whenever there is going to be a change in the directory.
vfs_link, vfs_unlink, and vfs_rename all have existing delegation break handling for the children in the rename. Add the necessary calls for breaking delegations in the parent(s) as well.
--- fs/namei.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
fs/namei.c +14 -1
@@ -4667,6 +4667,9 @@ int vfs_unlink(struct mnt_idmap *idmap, struct inode *dir,else { error =security_inode_unlink (dir, dentry);if (!error) { + error =try_break_deleg (dir, delegated_inode); +if (error) + goto out; error =try_break_deleg (target, delegated_inode);if (error) goto out;
@@ -4936,7 +4939,9 @@ int vfs_link(struct dentry *old_dentry, struct mnt_idmap *idmap,else if (max_links && inode->i_nlink >= max_links) error = -EMLINK ;else { - error =try_break_deleg (inode, delegated_inode); + error =try_break_deleg (dir, delegated_inode); +if (!error) + error =try_break_deleg (inode, delegated_inode);if (!error) error = dir->i_op->link (old_dentry, dir, new_dentry); }
@@ -5203,6 +5208,14 @@ int vfs_rename(struct renamedata *rd) old_dir->i_nlink >= max_links) goto out; } + error =try_break_deleg (old_dir, delegated_inode); +if (error) + goto out; +if (new_dir != old_dir) { + error =try_break_deleg (new_dir, delegated_inode); +if (error) + goto out; + }if (!is_dir) { error =try_break_deleg (source, delegated_inode);if (error)
Signature · 1 line
2.51.0
Jeff Layton
maintainerPATCH v3 3/13 vfs: allow mkdir to wait for delegation break on parent
In reply to Jeff LaytonIn order to add directory delegation support, we need to break delegations on the parent whenever there is going to be a change in the directory.
Add a new delegated_inode parameter to vfs_mkdir. All of the existing callers set that to NULL for now, except for do_mkdirat which will properly block until the lease is gone.
--- drivers/base/devtmpfs.c | 2 +- fs/cachefiles/namei.c | 2 +- fs/ecryptfs/inode.c | 2 +- fs/init.c | 2 +- fs/namei.c | 24 ++++++++++++++++++------ fs/nfsd/nfs4recover.c | 2 +- fs/nfsd/vfs.c | 2 +- fs/overlayfs/overlayfs.h | 2 +- fs/smb/server/vfs.c | 2 +- fs/xfs/scrub/orphanage.c | 2 +- include/linux/fs.h | 2 +- 11 files changed, 28 insertions(+), 16 deletions(-)
drivers/base/devtmpfs.c +1 -1
@@ -180,7 +180,7 @@ static int dev_mkdir(const char *name, umode_t mode)if (IS_ERR (dentry))return PTR_ERR (dentry); - dentry =vfs_mkdir (&nop_mnt_idmap,d_inode (path.dentry), dentry, mode); + dentry =vfs_mkdir (&nop_mnt_idmap,d_inode (path.dentry), dentry, mode,NULL );if (!IS_ERR (dentry))/* mark as kernel-created inode */ d_inode (dentry)->i_private = &thread;
fs/cachefiles/namei.c +1 -1
@@ -130,7 +130,7 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache, goto mkdir_error; ret =cachefiles_inject_write_error ();if (ret ==0 ) - subdir =vfs_mkdir (&nop_mnt_idmap,d_inode (dir), subdir,0700 ); + subdir =vfs_mkdir (&nop_mnt_idmap,d_inode (dir), subdir,0700 ,NULL );else subdir =ERR_PTR (ret);if (IS_ERR (subdir)) {
fs/ecryptfs/inode.c +1 -1
@@ -508,7 +508,7 @@ static struct dentry *ecryptfs_mkdir(struct mnt_idmap *idmap, struct inode *dir, goto out; lower_dentry =vfs_mkdir (&nop_mnt_idmap, lower_dir, - lower_dentry, mode); + lower_dentry, mode,NULL ); rc =PTR_ERR (lower_dentry);if (IS_ERR (lower_dentry)) goto out;
fs/init.c +1 -1
@@ -233,7 +233,7 @@ int __init init_mkdir(const char *pathname, umode_t mode) error =security_path_mkdir (&path, dentry, mode);if (!error) { dentry =vfs_mkdir (mnt_idmap (path.mnt), path.dentry->d_inode, - dentry, mode); + dentry, mode,NULL );if (IS_ERR (dentry)) error =PTR_ERR (dentry); }
fs/namei.c +18 -6
@@ -4407,10 +4407,11 @@ SYSCALL_DEFINE3(mknod, const char __user *, filename, umode_t, mode, unsigned, d/** * vfs_mkdir - create directory returning correct dentry if possible -* @idmap: idmap of the mount the inode was found from -* @dir: inode of the parent directory -* @dentry: dentry of the child directory -* @mode: mode of the child directory +* @idmap: idmap of the mount the inode was found from +* @dir: inode of the parent directory +* @dentry: dentry of the child directory +* @mode: mode of the child directory +* @delegated_inode: returns parent inode, if the inode is delegated. * * Create a directory. *
@@ -4427,7 +4428,8 @@ SYSCALL_DEFINE3(mknod, const char __user *, filename, umode_t, mode, unsigned, d* In case of an error the dentry is dput() and an ERR_PTR() is returned. */ struct dentry *vfs_mkdir (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode) +struct dentry *dentry,umode_t mode, +struct inode **delegated_inode) {int error;unsigned max_links = dir->i_sb->s_max_links;
@@ -4450,6 +4452,10 @@ struct dentry *vfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,if (max_links && dir->i_nlink >= max_links) goto err; + error =try_break_deleg (dir, delegated_inode); +if (error) + goto err; + de = dir->i_op->mkdir (idmap, dir, dentry, mode); error =PTR_ERR (de);if (IS_ERR (de))
@@ -4473,6 +4479,7 @@ int do_mkdirat(int dfd, struct filename *name, umode_t mode)struct path path;int error;unsigned int lookup_flags =LOOKUP_DIRECTORY ; +struct inode *delegated_inode =NULL ; retry: dentry =filename_create (dfd, name, &path, lookup_flags);
@@ -4484,11 +4491,16 @@ int do_mkdirat(int dfd, struct filename *name, umode_t mode) mode_strip_umask(path.dentry->d_inode, mode));if (!error) { dentry =vfs_mkdir (mnt_idmap (path.mnt), path.dentry->d_inode, - dentry, mode); + dentry, mode, &delegated_inode);if (IS_ERR (dentry)) error =PTR_ERR (dentry); }end_creating_path (&path, dentry); +if (delegated_inode) { + error =break_deleg_wait (&delegated_inode); +if (!error) + goto retry; + }if (retry_estale (error, lookup_flags)) { lookup_flags |=LOOKUP_REVAL ; goto retry;
fs/nfsd/nfs4recover.c +1 -1
@@ -202,7 +202,7 @@ nfsd4_create_clid_dir(struct nfs4_client *clp)* as well be forgiving and just succeed silently. */ goto out_put; - dentry =vfs_mkdir (&nop_mnt_idmap,d_inode (dir), dentry,S_IRWXU ); + dentry =vfs_mkdir (&nop_mnt_idmap,d_inode (dir), dentry,0700 ,NULL );if (IS_ERR (dentry)) status =PTR_ERR (dentry); out_put:
fs/nfsd/vfs.c +1 -1
@@ -1645,7 +1645,7 @@ nfsd_create_locked(struct svc_rqst *rqstp, struct svc_fh *fhp,nfsd_check_ignore_resizing (iap);break ;case S_IFDIR : - dchild =vfs_mkdir (&nop_mnt_idmap, dirp, dchild, iap->ia_mode); + dchild =vfs_mkdir (&nop_mnt_idmap, dirp, dchild, iap->ia_mode,NULL );if (IS_ERR (dchild)) { host_err =PTR_ERR (dchild); }else if (d_is_negative (dchild)) {
fs/overlayfs/overlayfs.h +1 -1
@@ -248,7 +248,7 @@ static inline struct dentry *ovl_do_mkdir(struct ovl_fs *ofs, {struct dentry *ret; - ret =vfs_mkdir (ovl_upper_mnt_idmap (ofs), dir, dentry, mode); + ret =vfs_mkdir (ovl_upper_mnt_idmap (ofs), dir, dentry, mode,NULL );pr_debug ("mkdir(%pd2, 0%o) = %i\n" , dentry, mode,PTR_ERR_OR_ZERO (ret));return ret; }
fs/smb/server/vfs.c +1 -1
@@ -230,7 +230,7 @@ int ksmbd_vfs_mkdir(struct ksmbd_work *work, const char *name, umode_t mode) idmap =mnt_idmap (path.mnt); mode |=S_IFDIR ; d = dentry; - dentry =vfs_mkdir (idmap,d_inode (path.dentry), dentry, mode); + dentry =vfs_mkdir (idmap,d_inode (path.dentry), dentry, mode,NULL );if (IS_ERR (dentry)) err =PTR_ERR (dentry);else if (d_is_negative (dentry))
fs/xfs/scrub/orphanage.c +1 -1
@@ -167,7 +167,7 @@ xrep_orphanage_create(*/ if (d_really_is_negative (orphanage_dentry)) { orphanage_dentry =vfs_mkdir (&nop_mnt_idmap, root_inode, - orphanage_dentry,0750 ); + orphanage_dentry,0750 ,NULL ); error =PTR_ERR (orphanage_dentry);if (IS_ERR (orphanage_dentry)) goto out_unlock_root;
include/linux/fs.h +1 -1
@@ -2113,7 +2113,7 @@ bool inode_owner_or_capable(struct mnt_idmap *idmap,int vfs_create (struct mnt_idmap *,struct inode *,struct dentry *,umode_t ,bool );struct dentry *vfs_mkdir (struct mnt_idmap *,struct inode *, -struct dentry *,umode_t ); +struct dentry *,umode_t ,struct inode **);int vfs_mknod (struct mnt_idmap *,struct inode *,struct dentry *,umode_t ,dev_t ); int vfs_symlink(struct mnt_idmap *, struct inode *,
Signature · 1 line
2.51.0
Christian Brauner
maintainerRe: [PATCH v3 03/13] vfs: allow mkdir to wait for delegation break on parent
Quoted 84 lines · Jeff Layton
In order to add directory delegation support, we need to break delegations on the parent whenever there is going to be a change in the directory.
Add a new
delegated_inodeparameter tovfs_mkdir. All of the existing callers set that to NULL for now, except fordo_mkdiratwhich will properly block until the lease is gone.Reviewed-by Jan Kara <[email protected]>Reviewed-by NeilBrown <[email protected]>Signed-off-by Jeff Layton <[email protected]>--- drivers/base/devtmpfs.c | 2 +- fs/cachefiles/namei.c | 2 +- fs/ecryptfs/inode.c | 2 +- fs/init.c | 2 +- fs/namei.c | 24 ++++++++++++++++++------ fs/nfsd/nfs4recover.c | 2 +- fs/nfsd/vfs.c | 2 +- fs/overlayfs/overlayfs.h | 2 +- fs/smb/server/vfs.c | 2 +- fs/xfs/scrub/orphanage.c | 2 +- include/linux/fs.h | 2 +- 11 files changed, 28 insertions(+), 16 deletions(-)drivers/base/devtmpfs.c +1
-1@@ -180,7 +180,7 @@ static int dev_mkdir(const char *name, umode_t mode)if (IS_ERR (dentry))return PTR_ERR (dentry); - dentry =vfs_mkdir (&nop_mnt_idmap,d_inode (path.dentry), dentry, mode); + dentry =vfs_mkdir (&nop_mnt_idmap,d_inode (path.dentry), dentry, mode,NULL );if (!IS_ERR (dentry))/* mark as kernel-created inode */ d_inode (dentry)->i_private = &thread;fs/cachefiles/namei.c +1
-1@@ -130,7 +130,7 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache, goto mkdir_error; ret =cachefiles_inject_write_error ();if (ret ==0 ) - subdir =vfs_mkdir (&nop_mnt_idmap,d_inode (dir), subdir,0700 ); + subdir =vfs_mkdir (&nop_mnt_idmap,d_inode (dir), subdir,0700 ,NULL );else subdir =ERR_PTR (ret);if (IS_ERR (subdir)) {fs/ecryptfs/inode.c +1
-1@@ -508,7 +508,7 @@ static struct dentry *ecryptfs_mkdir(struct mnt_idmap *idmap, struct inode *dir, goto out; lower_dentry =vfs_mkdir (&nop_mnt_idmap, lower_dir, - lower_dentry, mode); + lower_dentry, mode,NULL ); rc =PTR_ERR (lower_dentry);if (IS_ERR (lower_dentry)) goto out;fs/init.c +1
-1@@ -233,7 +233,7 @@ int __init init_mkdir(const char *pathname, umode_t mode) error =security_path_mkdir (&path, dentry, mode);if (!error) { dentry =vfs_mkdir (mnt_idmap (path.mnt), path.dentry->d_inode, - dentry, mode); + dentry, mode,NULL );if (IS_ERR (dentry)) error =PTR_ERR (dentry); }fs/namei.c +0
-0@@ -4407,10 +4407,11 @@ SYSCALL_DEFINE3(mknod, const char __user *, filename, umode_t, mode, unsigned, d/**
fs/namei.c SYSCALL_DEFINE3(mknod, const char __user *, filename, umode_t, mode, unsigned, d · line 4414
Quoted 10 lines
fs/namei.c +5
-4* vfs_mkdir - create directory returning correct dentry if possible -* @idmap: idmap of the mount the inode was found from -* @dir: inode of the parent directory -* @dentry: dentry of the child directory -* @mode: mode of the child directory +* @idmap: idmap of the mount the inode was found from +* @dir: inode of the parent directory +* @dentry: dentry of the child directory +* @mode: mode of the child directory +* @delegated_inode: returns parent inode, if the inode is delegated.
I wonder if it would be feasible and potentially elegant if delegated inodes were returned as separate type like struct delegated_inode similar to the vfsuid_t just a struct wrapper around the inode itself. The advantage is that it's not possible to accidently abuse this thing as we're passing that stuff around to try_break_deleg() and so on.
Quoted 132 lines
fs/namei.c +13
-2* * Create a directory. * @@ -4427,7 +4428,8 @@ SYSCALL_DEFINE3(mknod, const char __user *, filename, umode_t, mode, unsigned, d* In case of an error the dentry is dput() and an ERR_PTR() is returned. */ struct dentry *vfs_mkdir (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode) +struct dentry *dentry,umode_t mode, +struct inode **delegated_inode) {int error;unsigned max_links = dir->i_sb->s_max_links;@@ -4450,6 +4452,10 @@ struct dentry *vfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,if (max_links && dir->i_nlink >= max_links) goto err; + error =try_break_deleg (dir, delegated_inode); +if (error) + goto err; + de = dir->i_op->mkdir (idmap, dir, dentry, mode); error =PTR_ERR (de);if (IS_ERR (de))@@ -4473,6 +4479,7 @@ int do_mkdirat(int dfd, struct filename *name, umode_t mode)struct path path;int error;unsigned int lookup_flags =LOOKUP_DIRECTORY ; +struct inode *delegated_inode =NULL ; retry: dentry =filename_create (dfd, name, &path, lookup_flags);@@ -4484,11 +4491,16 @@ int do_mkdirat(int dfd, struct filename *name, umode_t mode) mode_strip_umask(path.dentry->d_inode, mode));if (!error) { dentry =vfs_mkdir (mnt_idmap (path.mnt), path.dentry->d_inode, - dentry, mode); + dentry, mode, &delegated_inode);if (IS_ERR (dentry)) error =PTR_ERR (dentry); }end_creating_path (&path, dentry); +if (delegated_inode) { + error =break_deleg_wait (&delegated_inode); +if (!error) + goto retry; + }if (retry_estale (error, lookup_flags)) { lookup_flags |=LOOKUP_REVAL ; goto retry;fs/nfsd/nfs4recover.c +1
-1@@ -202,7 +202,7 @@ nfsd4_create_clid_dir(struct nfs4_client *clp)* as well be forgiving and just succeed silently. */ goto out_put; - dentry =vfs_mkdir (&nop_mnt_idmap,d_inode (dir), dentry,S_IRWXU ); + dentry =vfs_mkdir (&nop_mnt_idmap,d_inode (dir), dentry,0700 ,NULL );if (IS_ERR (dentry)) status =PTR_ERR (dentry); out_put:fs/nfsd/vfs.c +1
-1@@ -1645,7 +1645,7 @@ nfsd_create_locked(struct svc_rqst *rqstp, struct svc_fh *fhp,nfsd_check_ignore_resizing (iap);break ;case S_IFDIR : - dchild =vfs_mkdir (&nop_mnt_idmap, dirp, dchild, iap->ia_mode); + dchild =vfs_mkdir (&nop_mnt_idmap, dirp, dchild, iap->ia_mode,NULL );if (IS_ERR (dchild)) { host_err =PTR_ERR (dchild); }else if (d_is_negative (dchild)) {fs/overlayfs/overlayfs.h +1
-1@@ -248,7 +248,7 @@ static inline struct dentry *ovl_do_mkdir(struct ovl_fs *ofs, {struct dentry *ret; - ret =vfs_mkdir (ovl_upper_mnt_idmap (ofs), dir, dentry, mode); + ret =vfs_mkdir (ovl_upper_mnt_idmap (ofs), dir, dentry, mode,NULL );pr_debug ("mkdir(%pd2, 0%o) = %i\n" , dentry, mode,PTR_ERR_OR_ZERO (ret));return ret; }fs/smb/server/vfs.c +1
-1@@ -230,7 +230,7 @@ int ksmbd_vfs_mkdir(struct ksmbd_work *work, const char *name, umode_t mode) idmap =mnt_idmap (path.mnt); mode |=S_IFDIR ; d = dentry; - dentry =vfs_mkdir (idmap,d_inode (path.dentry), dentry, mode); + dentry =vfs_mkdir (idmap,d_inode (path.dentry), dentry, mode,NULL );if (IS_ERR (dentry)) err =PTR_ERR (dentry);else if (d_is_negative (dentry))fs/xfs/scrub/orphanage.c +1
-1@@ -167,7 +167,7 @@ xrep_orphanage_create(*/ if (d_really_is_negative (orphanage_dentry)) { orphanage_dentry =vfs_mkdir (&nop_mnt_idmap, root_inode, - orphanage_dentry,0750 ); + orphanage_dentry,0750 ,NULL ); error =PTR_ERR (orphanage_dentry);if (IS_ERR (orphanage_dentry)) goto out_unlock_root;include/linux/fs.h +1
-1@@ -2113,7 +2113,7 @@ bool inode_owner_or_capable(struct mnt_idmap *idmap,int vfs_create (struct mnt_idmap *,struct inode *,struct dentry *,umode_t ,bool );struct dentry *vfs_mkdir (struct mnt_idmap *,struct inode *, -struct dentry *,umode_t ); +struct dentry *,umode_t ,struct inode **);int vfs_mknod (struct mnt_idmap *,struct inode *,struct dentry *,umode_t ,dev_t ); int vfs_symlink(struct mnt_idmap *, struct inode *,Signature · 2 lines
-- 2.51.0
Jeff Layton
maintainerRe: [PATCH v3 03/13] vfs: allow mkdir to wait for delegation break on parent
Quoted 93 lines · Christian Brauner
Quoted 92 lines · Jeff Layton
In order to add directory delegation support, we need to break delegations on the parent whenever there is going to be a change in the directory.
Add a new
delegated_inodeparameter tovfs_mkdir. All of the existing callers set that to NULL for now, except fordo_mkdiratwhich will properly block until the lease is gone.Reviewed-by Jan Kara <[email protected]>Reviewed-by NeilBrown <[email protected]>Signed-off-by Jeff Layton <[email protected]>--- drivers/base/devtmpfs.c | 2 +- fs/cachefiles/namei.c | 2 +- fs/ecryptfs/inode.c | 2 +- fs/init.c | 2 +- fs/namei.c | 24 ++++++++++++++++++------ fs/nfsd/nfs4recover.c | 2 +- fs/nfsd/vfs.c | 2 +- fs/overlayfs/overlayfs.h | 2 +- fs/smb/server/vfs.c | 2 +- fs/xfs/scrub/orphanage.c | 2 +- include/linux/fs.h | 2 +- 11 files changed, 28 insertions(+), 16 deletions(-)drivers/base/devtmpfs.c +1
-1@@ -180,7 +180,7 @@ static int dev_mkdir(const char *name, umode_t mode)if (IS_ERR (dentry))return PTR_ERR (dentry); - dentry =vfs_mkdir (&nop_mnt_idmap,d_inode (path.dentry), dentry, mode); + dentry =vfs_mkdir (&nop_mnt_idmap,d_inode (path.dentry), dentry, mode,NULL );if (!IS_ERR (dentry))/* mark as kernel-created inode */ d_inode (dentry)->i_private = &thread;fs/cachefiles/namei.c +1
-1@@ -130,7 +130,7 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache, goto mkdir_error; ret =cachefiles_inject_write_error ();if (ret ==0 ) - subdir =vfs_mkdir (&nop_mnt_idmap,d_inode (dir), subdir,0700 ); + subdir =vfs_mkdir (&nop_mnt_idmap,d_inode (dir), subdir,0700 ,NULL );else subdir =ERR_PTR (ret);if (IS_ERR (subdir)) {fs/ecryptfs/inode.c +1
-1@@ -508,7 +508,7 @@ static struct dentry *ecryptfs_mkdir(struct mnt_idmap *idmap, struct inode *dir, goto out; lower_dentry =vfs_mkdir (&nop_mnt_idmap, lower_dir, - lower_dentry, mode); + lower_dentry, mode,NULL ); rc =PTR_ERR (lower_dentry);if (IS_ERR (lower_dentry)) goto out;fs/init.c +1
-1@@ -233,7 +233,7 @@ int __init init_mkdir(const char *pathname, umode_t mode) error =security_path_mkdir (&path, dentry, mode);if (!error) { dentry =vfs_mkdir (mnt_idmap (path.mnt), path.dentry->d_inode, - dentry, mode); + dentry, mode,NULL );if (IS_ERR (dentry)) error =PTR_ERR (dentry); }fs/namei.c +3
-4@@ -4407,10 +4407,11 @@ SYSCALL_DEFINE3(mknod, const char __user *, filename, umode_t, mode, unsigned, d/** * vfs_mkdir - create directory returning correct dentry if possible -* @idmap: idmap of the mount the inode was found from -* @dir: inode of the parent directory -* @dentry: dentry of the child directory -* @mode: mode of the child directory +* @idmap: idmap of the mount the inode was found from +* @dir: inode of the parent directory +* @dentry: dentry of the child directory
Quoted 9 lines
fs/namei.c SYSCALL_DEFINE3(mknod, const char __user *, filename, umode_t, mode, unsigned, d · line 4414
Quoted 2 lines
fs/namei.c +2
-0+* @mode: mode of the child directory +* @delegated_inode: returns parent inode, if the inode is delegated. I wonder if it would be feasible and potentially elegant if delegated inodes were returned as separate type like struct
delegated_inodesimilar to thevfsuid_tjust a struct wrapper around the inode itself. The advantage is that it's not possible to accidently abuse this thing as we're passing that stuff around totry_break_deleg()and so on.
I have a patch that does exactly that:
https://lore.kernel.org/linux-nfs/[email protected]/
I didn't submit it here since it wasn't strictly required for this patchset. If we get around to implementing CB_NOTIFY support however, it will be since we'll need to pass back other information than just the inode.
I could move that into this series if you prefer. If we do that though, then it might also be cleaner to take the previous patch in the series that cleans up __break_lease() arguments:
https://lore.kernel.org/linux-nfs/[email protected]/
Let me know what you'd prefer.
Quoted 132 lines
Quoted 132 lines
fs/namei.c +13
-2* * Create a directory. * @@ -4427,7 +4428,8 @@ SYSCALL_DEFINE3(mknod, const char __user *, filename, umode_t, mode, unsigned, d* In case of an error the dentry is dput() and an ERR_PTR() is returned. */ struct dentry *vfs_mkdir (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode) +struct dentry *dentry,umode_t mode, +struct inode **delegated_inode) {int error;unsigned max_links = dir->i_sb->s_max_links;@@ -4450,6 +4452,10 @@ struct dentry *vfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,if (max_links && dir->i_nlink >= max_links) goto err; + error =try_break_deleg (dir, delegated_inode); +if (error) + goto err; + de = dir->i_op->mkdir (idmap, dir, dentry, mode); error =PTR_ERR (de);if (IS_ERR (de))@@ -4473,6 +4479,7 @@ int do_mkdirat(int dfd, struct filename *name, umode_t mode)struct path path;int error;unsigned int lookup_flags =LOOKUP_DIRECTORY ; +struct inode *delegated_inode =NULL ; retry: dentry =filename_create (dfd, name, &path, lookup_flags);@@ -4484,11 +4491,16 @@ int do_mkdirat(int dfd, struct filename *name, umode_t mode) mode_strip_umask(path.dentry->d_inode, mode));if (!error) { dentry =vfs_mkdir (mnt_idmap (path.mnt), path.dentry->d_inode, - dentry, mode); + dentry, mode, &delegated_inode);if (IS_ERR (dentry)) error =PTR_ERR (dentry); }end_creating_path (&path, dentry); +if (delegated_inode) { + error =break_deleg_wait (&delegated_inode); +if (!error) + goto retry; + }if (retry_estale (error, lookup_flags)) { lookup_flags |=LOOKUP_REVAL ; goto retry;fs/nfsd/nfs4recover.c +1
-1@@ -202,7 +202,7 @@ nfsd4_create_clid_dir(struct nfs4_client *clp)* as well be forgiving and just succeed silently. */ goto out_put; - dentry =vfs_mkdir (&nop_mnt_idmap,d_inode (dir), dentry,S_IRWXU ); + dentry =vfs_mkdir (&nop_mnt_idmap,d_inode (dir), dentry,0700 ,NULL );if (IS_ERR (dentry)) status =PTR_ERR (dentry); out_put:fs/nfsd/vfs.c +1
-1@@ -1645,7 +1645,7 @@ nfsd_create_locked(struct svc_rqst *rqstp, struct svc_fh *fhp,nfsd_check_ignore_resizing (iap);break ;case S_IFDIR : - dchild =vfs_mkdir (&nop_mnt_idmap, dirp, dchild, iap->ia_mode); + dchild =vfs_mkdir (&nop_mnt_idmap, dirp, dchild, iap->ia_mode,NULL );if (IS_ERR (dchild)) { host_err =PTR_ERR (dchild); }else if (d_is_negative (dchild)) {fs/overlayfs/overlayfs.h +1
-1@@ -248,7 +248,7 @@ static inline struct dentry *ovl_do_mkdir(struct ovl_fs *ofs, {struct dentry *ret; - ret =vfs_mkdir (ovl_upper_mnt_idmap (ofs), dir, dentry, mode); + ret =vfs_mkdir (ovl_upper_mnt_idmap (ofs), dir, dentry, mode,NULL );pr_debug ("mkdir(%pd2, 0%o) = %i\n" , dentry, mode,PTR_ERR_OR_ZERO (ret));return ret; }fs/smb/server/vfs.c +1
-1@@ -230,7 +230,7 @@ int ksmbd_vfs_mkdir(struct ksmbd_work *work, const char *name, umode_t mode) idmap =mnt_idmap (path.mnt); mode |=S_IFDIR ; d = dentry; - dentry =vfs_mkdir (idmap,d_inode (path.dentry), dentry, mode); + dentry =vfs_mkdir (idmap,d_inode (path.dentry), dentry, mode,NULL );if (IS_ERR (dentry)) err =PTR_ERR (dentry);else if (d_is_negative (dentry))fs/xfs/scrub/orphanage.c +1
-1@@ -167,7 +167,7 @@ xrep_orphanage_create(*/ if (d_really_is_negative (orphanage_dentry)) { orphanage_dentry =vfs_mkdir (&nop_mnt_idmap, root_inode, - orphanage_dentry,0750 ); + orphanage_dentry,0750 ,NULL ); error =PTR_ERR (orphanage_dentry);if (IS_ERR (orphanage_dentry)) goto out_unlock_root;include/linux/fs.h +1
-1@@ -2113,7 +2113,7 @@ bool inode_owner_or_capable(struct mnt_idmap *idmap,int vfs_create (struct mnt_idmap *,struct inode *,struct dentry *,umode_t ,bool );struct dentry *vfs_mkdir (struct mnt_idmap *,struct inode *, -struct dentry *,umode_t ); +struct dentry *,umode_t ,struct inode **);int vfs_mknod (struct mnt_idmap *,struct inode *,struct dentry *,umode_t ,dev_t ); int vfs_symlink(struct mnt_idmap *, struct inode *,Signature · 2 lines
-- 2.51.0
Signature · 1 line
Jeff Layton <[email protected]>
Christian Brauner
maintainerRe: [PATCH v3 03/13] vfs: allow mkdir to wait for delegation break on parent
Quoted 104 lines · Jeff Layton
Quoted 93 lines · Christian Brauner
Quoted 92 lines · Jeff Layton
In order to add directory delegation support, we need to break delegations on the parent whenever there is going to be a change in the directory.
Add a new
delegated_inodeparameter tovfs_mkdir. All of the existing callers set that to NULL for now, except fordo_mkdiratwhich will properly block until the lease is gone.Reviewed-by Jan Kara <[email protected]>Reviewed-by NeilBrown <[email protected]>Signed-off-by Jeff Layton <[email protected]>--- drivers/base/devtmpfs.c | 2 +- fs/cachefiles/namei.c | 2 +- fs/ecryptfs/inode.c | 2 +- fs/init.c | 2 +- fs/namei.c | 24 ++++++++++++++++++------ fs/nfsd/nfs4recover.c | 2 +- fs/nfsd/vfs.c | 2 +- fs/overlayfs/overlayfs.h | 2 +- fs/smb/server/vfs.c | 2 +- fs/xfs/scrub/orphanage.c | 2 +- include/linux/fs.h | 2 +- 11 files changed, 28 insertions(+), 16 deletions(-)drivers/base/devtmpfs.c +1
-1@@ -180,7 +180,7 @@ static int dev_mkdir(const char *name, umode_t mode)if (IS_ERR (dentry))return PTR_ERR (dentry); - dentry =vfs_mkdir (&nop_mnt_idmap,d_inode (path.dentry), dentry, mode); + dentry =vfs_mkdir (&nop_mnt_idmap,d_inode (path.dentry), dentry, mode,NULL );if (!IS_ERR (dentry))/* mark as kernel-created inode */ d_inode (dentry)->i_private = &thread;fs/cachefiles/namei.c +1
-1@@ -130,7 +130,7 @@ struct dentry *cachefiles_get_directory(struct cachefiles_cache *cache, goto mkdir_error; ret =cachefiles_inject_write_error ();if (ret ==0 ) - subdir =vfs_mkdir (&nop_mnt_idmap,d_inode (dir), subdir,0700 ); + subdir =vfs_mkdir (&nop_mnt_idmap,d_inode (dir), subdir,0700 ,NULL );else subdir =ERR_PTR (ret);if (IS_ERR (subdir)) {fs/ecryptfs/inode.c +1
-1@@ -508,7 +508,7 @@ static struct dentry *ecryptfs_mkdir(struct mnt_idmap *idmap, struct inode *dir, goto out; lower_dentry =vfs_mkdir (&nop_mnt_idmap, lower_dir, - lower_dentry, mode); + lower_dentry, mode,NULL ); rc =PTR_ERR (lower_dentry);if (IS_ERR (lower_dentry)) goto out;fs/init.c +1
-1@@ -233,7 +233,7 @@ int __init init_mkdir(const char *pathname, umode_t mode) error =security_path_mkdir (&path, dentry, mode);if (!error) { dentry =vfs_mkdir (mnt_idmap (path.mnt), path.dentry->d_inode, - dentry, mode); + dentry, mode,NULL );if (IS_ERR (dentry)) error =PTR_ERR (dentry); }fs/namei.c +3
-4@@ -4407,10 +4407,11 @@ SYSCALL_DEFINE3(mknod, const char __user *, filename, umode_t, mode, unsigned, d/** * vfs_mkdir - create directory returning correct dentry if possible -* @idmap: idmap of the mount the inode was found from -* @dir: inode of the parent directory -* @dentry: dentry of the child directory -* @mode: mode of the child directory +* @idmap: idmap of the mount the inode was found from +* @dir: inode of the parent directory +* @dentry: dentry of the child directory Quoted 9 lines
fs/namei.c SYSCALL_DEFINE3(mknod, const char __user *, filename, umode_t, mode, unsigned, d · line 4414
Quoted 2 lines
fs/namei.c +2
-0+* @mode: mode of the child directory +* @delegated_inode: returns parent inode, if the inode is delegated. I wonder if it would be feasible and potentially elegant if delegated inodes were returned as separate type like struct
delegated_inodesimilar to thevfsuid_tjust a struct wrapper around the inode itself. The advantage is that it's not possible to accidently abuse this thing as we're passing that stuff around totry_break_deleg()and so on.
Quoted 3 lines
I have a patch that does exactly that:
I love it!
Quoted 11 lines
I didn't submit it here since it wasn't strictly required for this patchset. If we get around to implementing
CB_NOTIFYsupport however, it will be since we'll need to pass back other information than just the inode.I could move that into this series if you prefer. If we do that though, then it might also be cleaner to take the previous patch in the series that cleans up
__break_lease()arguments:
If you have a wholesome story to tell then by all means tell it all. Don't GRRM us with half a tale. IOW, it's fine to have a large patch series. If it's well split-up then it's great. Al or I apparently can't get a series out the door that's under 20 patches so you get the same leeway. :)
Quoted 138 lines
Let me know what you'd prefer.
Quoted 132 lines
Quoted 132 lines
fs/namei.c +13
-2* * Create a directory. * @@ -4427,7 +4428,8 @@ SYSCALL_DEFINE3(mknod, const char __user *, filename, umode_t, mode, unsigned, d* In case of an error the dentry is dput() and an ERR_PTR() is returned. */ struct dentry *vfs_mkdir (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode) +struct dentry *dentry,umode_t mode, +struct inode **delegated_inode) {int error;unsigned max_links = dir->i_sb->s_max_links;@@ -4450,6 +4452,10 @@ struct dentry *vfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,if (max_links && dir->i_nlink >= max_links) goto err; + error =try_break_deleg (dir, delegated_inode); +if (error) + goto err; + de = dir->i_op->mkdir (idmap, dir, dentry, mode); error =PTR_ERR (de);if (IS_ERR (de))@@ -4473,6 +4479,7 @@ int do_mkdirat(int dfd, struct filename *name, umode_t mode)struct path path;int error;unsigned int lookup_flags =LOOKUP_DIRECTORY ; +struct inode *delegated_inode =NULL ; retry: dentry =filename_create (dfd, name, &path, lookup_flags);@@ -4484,11 +4491,16 @@ int do_mkdirat(int dfd, struct filename *name, umode_t mode) mode_strip_umask(path.dentry->d_inode, mode));if (!error) { dentry =vfs_mkdir (mnt_idmap (path.mnt), path.dentry->d_inode, - dentry, mode); + dentry, mode, &delegated_inode);if (IS_ERR (dentry)) error =PTR_ERR (dentry); }end_creating_path (&path, dentry); +if (delegated_inode) { + error =break_deleg_wait (&delegated_inode); +if (!error) + goto retry; + }if (retry_estale (error, lookup_flags)) { lookup_flags |=LOOKUP_REVAL ; goto retry;fs/nfsd/nfs4recover.c +1
-1@@ -202,7 +202,7 @@ nfsd4_create_clid_dir(struct nfs4_client *clp)* as well be forgiving and just succeed silently. */ goto out_put; - dentry =vfs_mkdir (&nop_mnt_idmap,d_inode (dir), dentry,S_IRWXU ); + dentry =vfs_mkdir (&nop_mnt_idmap,d_inode (dir), dentry,0700 ,NULL );if (IS_ERR (dentry)) status =PTR_ERR (dentry); out_put:fs/nfsd/vfs.c +1
-1@@ -1645,7 +1645,7 @@ nfsd_create_locked(struct svc_rqst *rqstp, struct svc_fh *fhp,nfsd_check_ignore_resizing (iap);break ;case S_IFDIR : - dchild =vfs_mkdir (&nop_mnt_idmap, dirp, dchild, iap->ia_mode); + dchild =vfs_mkdir (&nop_mnt_idmap, dirp, dchild, iap->ia_mode,NULL );if (IS_ERR (dchild)) { host_err =PTR_ERR (dchild); }else if (d_is_negative (dchild)) {fs/overlayfs/overlayfs.h +1
-1@@ -248,7 +248,7 @@ static inline struct dentry *ovl_do_mkdir(struct ovl_fs *ofs, {struct dentry *ret; - ret =vfs_mkdir (ovl_upper_mnt_idmap (ofs), dir, dentry, mode); + ret =vfs_mkdir (ovl_upper_mnt_idmap (ofs), dir, dentry, mode,NULL );pr_debug ("mkdir(%pd2, 0%o) = %i\n" , dentry, mode,PTR_ERR_OR_ZERO (ret));return ret; }fs/smb/server/vfs.c +1
-1@@ -230,7 +230,7 @@ int ksmbd_vfs_mkdir(struct ksmbd_work *work, const char *name, umode_t mode) idmap =mnt_idmap (path.mnt); mode |=S_IFDIR ; d = dentry; - dentry =vfs_mkdir (idmap,d_inode (path.dentry), dentry, mode); + dentry =vfs_mkdir (idmap,d_inode (path.dentry), dentry, mode,NULL );if (IS_ERR (dentry)) err =PTR_ERR (dentry);else if (d_is_negative (dentry))fs/xfs/scrub/orphanage.c +1
-1@@ -167,7 +167,7 @@ xrep_orphanage_create(*/ if (d_really_is_negative (orphanage_dentry)) { orphanage_dentry =vfs_mkdir (&nop_mnt_idmap, root_inode, - orphanage_dentry,0750 ); + orphanage_dentry,0750 ,NULL ); error =PTR_ERR (orphanage_dentry);if (IS_ERR (orphanage_dentry)) goto out_unlock_root;include/linux/fs.h +1
-1@@ -2113,7 +2113,7 @@ bool inode_owner_or_capable(struct mnt_idmap *idmap,int vfs_create (struct mnt_idmap *,struct inode *,struct dentry *,umode_t ,bool );struct dentry *vfs_mkdir (struct mnt_idmap *,struct inode *, -struct dentry *,umode_t ); +struct dentry *,umode_t ,struct inode **);int vfs_mknod (struct mnt_idmap *,struct inode *,struct dentry *,umode_t ,dev_t ); int vfs_symlink(struct mnt_idmap *, struct inode *,Signature · 2 lines
-- 2.51.0Signature · 1 line
Jeff Layton <[email protected]>
Jeff Layton
maintainerPATCH v3 4/13 vfs: allow rmdir to wait for delegation break on parent
In reply to Jeff LaytonIn order to add directory delegation support, we need to break delegations on the parent whenever there is going to be a change in the directory.
Add a "delegated_inode" return pointer to vfs_rmdir() and populate that pointer with the parent inode if it's non-NULL. Most existing in-kernel callers pass in a NULL pointer.
--- drivers/base/devtmpfs.c | 2 +- fs/ecryptfs/inode.c | 2 +- fs/namei.c | 22 +++++++++++++++++----- fs/nfsd/nfs4recover.c | 4 ++-- fs/nfsd/vfs.c | 2 +- fs/overlayfs/overlayfs.h | 2 +- fs/smb/server/vfs.c | 4 ++-- include/linux/fs.h | 3 ++- 8 files changed, 27 insertions(+), 14 deletions(-)
drivers/base/devtmpfs.c +1 -1
@@ -261,7 +261,7 @@ static int dev_rmdir(const char *name)return PTR_ERR (dentry);if (d_inode (dentry)->i_private == &thread) err =vfs_rmdir (&nop_mnt_idmap,d_inode (parent.dentry), - dentry); + dentry,NULL );else err = -EPERM ;
fs/ecryptfs/inode.c +1 -1
@@ -540,7 +540,7 @@ static int ecryptfs_rmdir(struct inode *dir, struct dentry *dentry)if (d_unhashed (lower_dentry)) rc = -EINVAL ;else - rc =vfs_rmdir (&nop_mnt_idmap, lower_dir, lower_dentry); + rc =vfs_rmdir (&nop_mnt_idmap, lower_dir, lower_dentry,NULL ); }if (!rc) {clear_nlink (d_inode (dentry));
fs/namei.c +17 -5
@@ -4522,9 +4522,10 @@ SYSCALL_DEFINE2(mkdir, const char __user *, pathname, umode_t, mode)/** * vfs_rmdir - remove directory -* @idmap: idmap of the mount the inode was found from -* @dir: inode of the parent directory -* @dentry: dentry of the child directory +* @idmap: idmap of the mount the inode was found from +* @dir: inode of the parent directory +* @dentry: dentry of the child directory +* @delegated_inode: returns parent inode, if it's delegated. * * Remove a directory. *
@@ -4535,7 +4536,7 @@ SYSCALL_DEFINE2(mkdir, const char __user *, pathname, umode_t, mode)* raw inode simply pass @nop_mnt_idmap. */ int vfs_rmdir (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry) +struct dentry *dentry,struct inode **delegated_inode) {int error =may_delete (idmap, dir, dentry,1 );
@@ -4557,6 +4558,10 @@ int vfs_rmdir(struct mnt_idmap *idmap, struct inode *dir,if (error) goto out; + error =try_break_deleg (dir, delegated_inode); +if (error) + goto out; + error = dir->i_op->rmdir (dir, dentry);if (error) goto out;
@@ -4583,6 +4588,7 @@ int do_rmdir(int dfd, struct filename *name)struct qstr last;int type;unsigned int lookup_flags =0 ; +struct inode *delegated_inode =NULL ; retry: error =filename_parentat (dfd, name, lookup_flags, &path, &last, &type);if (error)
@@ -4612,7 +4618,8 @@ int do_rmdir(int dfd, struct filename *name) error =security_path_rmdir (&path, dentry);if (error) goto exit4; - error =vfs_rmdir (mnt_idmap (path.mnt), path.dentry->d_inode, dentry); + error =vfs_rmdir (mnt_idmap (path.mnt), path.dentry->d_inode, + dentry, &delegated_inode); exit4:dput (dentry); exit3:
@@ -4620,6 +4627,11 @@ int do_rmdir(int dfd, struct filename *name)mnt_drop_write (path.mnt); exit2:path_put (&path); +if (delegated_inode) { + error =break_deleg_wait (&delegated_inode); +if (!error) + goto retry; + }if (retry_estale (error, lookup_flags)) { lookup_flags |=LOOKUP_REVAL ; goto retry;
fs/nfsd/nfs4recover.c +2 -2
@@ -315,7 +315,7 @@ nfsd4_unlink_clid_dir(char *name, struct nfsd_net *nn) status = -ENOENT ;if (d_really_is_negative (dentry)) goto out; - status =vfs_rmdir (&nop_mnt_idmap,d_inode (dir), dentry); + status =vfs_rmdir (&nop_mnt_idmap,d_inode (dir), dentry,NULL ); out:dput (dentry); out_unlock:
@@ -409,7 +409,7 @@ purge_old(struct dentry *parent, char *cname, struct nfsd_net *nn)inode_lock_nested (d_inode (parent),I_MUTEX_PARENT ); child =lookup_one (&nop_mnt_idmap, &QSTR (cname), parent);if (!IS_ERR (child)) { - status =vfs_rmdir (&nop_mnt_idmap,d_inode (parent), child); + status =vfs_rmdir (&nop_mnt_idmap,d_inode (parent), child,NULL );if (status)printk ("failed to remove client recovery directory %pd\n" , child);
fs/nfsd/vfs.c +1 -1
@@ -2195,7 +2195,7 @@ nfsd_unlink(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,break ; } }else { - host_err =vfs_rmdir (&nop_mnt_idmap, dirp, rdentry); + host_err =vfs_rmdir (&nop_mnt_idmap, dirp, rdentry,NULL ); }fh_fill_post_attrs (fhp);
fs/overlayfs/overlayfs.h +1 -1
@@ -206,7 +206,7 @@ static inline int ovl_do_notify_change(struct ovl_fs *ofs,static inline int ovl_do_rmdir (struct ovl_fs *ofs,struct inode *dir,struct dentry *dentry) { -int err =vfs_rmdir (ovl_upper_mnt_idmap (ofs), dir, dentry); +int err =vfs_rmdir (ovl_upper_mnt_idmap (ofs), dir, dentry,NULL );pr_debug ("rmdir(%pd2) = %i\n" , dentry, err);return err;
fs/smb/server/vfs.c +2 -2
@@ -609,7 +609,7 @@ int ksmbd_vfs_remove_file(struct ksmbd_work *work, const struct path *path) idmap =mnt_idmap (path->mnt);if (S_ISDIR (d_inode (path->dentry)->i_mode)) { - err =vfs_rmdir (idmap,d_inode (parent), path->dentry); + err =vfs_rmdir (idmap,d_inode (parent), path->dentry,NULL );if (err && err != -ENOTEMPTY )ksmbd_debug (VFS ,"rmdir failed, err %d\n" , err); }else {
@@ -1090,7 +1090,7 @@ int ksmbd_vfs_unlink(struct file *filp)dget (dentry);if (S_ISDIR (d_inode (dentry)->i_mode)) - err =vfs_rmdir (idmap,d_inode (dir), dentry); + err =vfs_rmdir (idmap,d_inode (dir), dentry,NULL );else err =vfs_unlink (idmap,d_inode (dir), dentry,NULL );
include/linux/fs.h +2 -1
@@ -2120,7 +2120,8 @@ int vfs_symlink(struct mnt_idmap *, struct inode *, struct dentry *, const char *);int vfs_link (struct dentry *,struct mnt_idmap *,struct inode *,struct dentry *,struct inode **); -int vfs_rmdir (struct mnt_idmap *,struct inode *,struct dentry *); +int vfs_rmdir (struct mnt_idmap *,struct inode *,struct dentry *, +struct inode **);int vfs_unlink (struct mnt_idmap *,struct inode *,struct dentry *,struct inode **);
Signature · 1 line
2.51.0
Jeff Layton
maintainerPATCH v3 5/13 vfs: break parent dir delegations in open(..., O_CREAT) codepath
In reply to Jeff LaytonIn order to add directory delegation support, we need to break delegations on the parent whenever there is going to be a change in the directory.
Add a delegated_inode parameter to lookup_open and have it break the delegation. Then, open_last_lookups can wait for the delegation break and retry the call to lookup_open once it's done.
--- fs/namei.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)
fs/namei.c +18 -4
@@ -3697,7 +3697,7 @@ static struct dentry *atomic_open(struct nameidata *nd, struct dentry *dentry,*/ static struct dentry *lookup_open (struct nameidata *nd,struct file *file,const struct open_flags *op, -bool got_write) +bool got_write,struct inode **delegated_inode) {struct mnt_idmap *idmap;struct dentry *dir = nd->path.dentry;
@@ -3786,6 +3786,11 @@ static struct dentry *lookup_open(struct nameidata *nd, struct file *file,/* Negative dentry, just create the file */ if (!dentry->d_inode && (open_flag &O_CREAT )) { +/* but break the directory lease first! */ + error =try_break_deleg (dir_inode, delegated_inode); +if (error) + goto out_dput; + file->f_mode |=FMODE_CREATED ;audit_inode_child (dir_inode, dentry,AUDIT_TYPE_CHILD_CREATE );if (!dir_inode->i_op->create) {
@@ -3849,6 +3854,7 @@ static const char *open_last_lookups(struct nameidata *nd, struct file *file, const struct open_flags *op) { struct dentry *dir = nd->path.dentry; +struct inode *delegated_inode =NULL ;int open_flag = op->open_flag;bool got_write = false;struct dentry *dentry;
@@ -3879,7 +3885,7 @@ static const char *open_last_lookups(struct nameidata *nd,return ERR_PTR (-ECHILD ); } } - +retry:if (open_flag & (O_CREAT |O_TRUNC |O_WRONLY |O_RDWR )) { got_write = !mnt_want_write (nd->path.mnt);/*
@@ -3892,7 +3898,7 @@ static const char *open_last_lookups(struct nameidata *nd,inode_lock (dir->d_inode); else inode_lock_shared(dir->d_inode); - dentry =lookup_open (nd, file, op, got_write); + dentry =lookup_open (nd, file, op, got_write, &delegated_inode);if (!IS_ERR (dentry)) {if (file->f_mode &FMODE_CREATED )fsnotify_create (dir->d_inode, dentry);
@@ -3907,8 +3913,16 @@ static const char *open_last_lookups(struct nameidata *nd,if (got_write)mnt_drop_write (nd->path.mnt); -if (IS_ERR (dentry)) +if (IS_ERR (dentry)) { +if (delegated_inode) { +int error =break_deleg_wait (&delegated_inode); + +if (!error) + goto retry; +return ERR_PTR (error); + }return ERR_CAST (dentry); + }if (file->f_mode & (FMODE_OPENED |FMODE_CREATED )) {dput (nd->path.dentry);
Signature · 1 line
2.51.0
Jeff Layton
maintainerPATCH v3 6/13 vfs: make vfs_create break delegations on parent directory
In reply to Jeff LaytonIn order to add directory delegation support, we need to break delegations on the parent whenever there is going to be a change in the directory.
Add a delegated_inode parameter to vfs_create. Most callers are converted to pass in NULL, but do_mknodat() is changed to wait for a delegation break if there is one.
--- fs/ecryptfs/inode.c | 2 +- fs/namei.c | 26 +++++++++++++++++++------- fs/nfsd/nfs3proc.c | 2 +- fs/nfsd/vfs.c | 3 +-- fs/open.c | 2 +- fs/overlayfs/overlayfs.h | 2 +- fs/smb/server/vfs.c | 2 +- include/linux/fs.h | 2 +- 8 files changed, 26 insertions(+), 15 deletions(-)
fs/ecryptfs/inode.c +1 -1
@@ -189,7 +189,7 @@ ecryptfs_do_create(struct inode *directory_inode, rc =lock_parent (ecryptfs_dentry, &lower_dentry, &lower_dir);if (!rc) rc =vfs_create (&nop_mnt_idmap, lower_dir, - lower_dentry, mode, true); + lower_dentry, mode, true,NULL );if (rc) {printk (KERN_ERR "%s: Failure to create dentry in lower fs; " "rc = [%d]\n" , __func__, rc);
fs/namei.c +19 -7
@@ -3460,11 +3460,12 @@ static inline umode_t vfs_prepare_mode(struct mnt_idmap *idmap,/** * vfs_create - create new file -* @idmap: idmap of the mount the inode was found from -* @dir: inode of the parent directory -* @dentry: dentry of the child file -* @mode: mode of the child file -* @want_excl: whether the file must not yet exist +* @idmap: idmap of the mount the inode was found from +* @dir: inode of the parent directory +* @dentry: dentry of the child file +* @mode: mode of the child file +* @want_excl: whether the file must not yet exist +* @delegated_inode: returns parent inode, if the inode is delegated. * * Create a new file. *
@@ -3475,7 +3476,8 @@ static inline umode_t vfs_prepare_mode(struct mnt_idmap *idmap,* raw inode simply pass @nop_mnt_idmap. */ int vfs_create (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode,bool want_excl) +struct dentry *dentry,umode_t mode,bool want_excl, +struct inode **delegated_inode) {int error;
@@ -3488,6 +3490,9 @@ int vfs_create(struct mnt_idmap *idmap, struct inode *dir, mode =vfs_prepare_mode (idmap, dir, mode,S_IALLUGO ,S_IFREG ); error =security_inode_create (dir, dentry, mode); +if (error) +return error; + error =try_break_deleg (dir, delegated_inode);if (error)return error; error = dir->i_op->create (idmap, dir, dentry, mode, want_excl);
@@ -4365,6 +4370,7 @@ static int do_mknodat(int dfd, struct filename *name, umode_t mode,struct path path;int error;unsigned int lookup_flags =0 ; +struct inode *delegated_inode =NULL ; error =may_mknod (mode);if (error)
@@ -4384,7 +4390,8 @@ static int do_mknodat(int dfd, struct filename *name, umode_t mode,switch (mode &S_IFMT ) {case 0 :case S_IFREG : error =vfs_create (idmap, path.dentry->d_inode, - dentry, mode, true); + dentry, mode, true, + &delegated_inode);if (!error)security_path_post_mknod (idmap, dentry);break ;
@@ -4399,6 +4406,11 @@ static int do_mknodat(int dfd, struct filename *name, umode_t mode, } out2:end_creating_path (&path, dentry); +if (delegated_inode) { + error =break_deleg_wait (&delegated_inode); +if (!error) + goto retry; + }if (retry_estale (error, lookup_flags)) { lookup_flags |=LOOKUP_REVAL ; goto retry;
fs/nfsd/nfs3proc.c +1 -1
@@ -344,7 +344,7 @@ nfsd3_create_file(struct svc_rqst *rqstp, struct svc_fh *fhp, status =fh_fill_pre_attrs (fhp);if (status != nfs_ok) goto out; - host_err =vfs_create (&nop_mnt_idmap, inode, child, iap->ia_mode, true); + host_err =vfs_create (&nop_mnt_idmap, inode, child, iap->ia_mode, true,NULL );if (host_err <0 ) { status =nfserrno (host_err); goto out;
fs/nfsd/vfs.c +1 -2
@@ -1639,8 +1639,7 @@ nfsd_create_locked(struct svc_rqst *rqstp, struct svc_fh *fhp, err =0 ;switch (type) {case S_IFREG : - host_err =vfs_create (&nop_mnt_idmap, dirp, dchild, - iap->ia_mode, true); + host_err =vfs_create (&nop_mnt_idmap, dirp, dchild, iap->ia_mode, true,NULL );if (!host_err)nfsd_check_ignore_resizing (iap);break ;
fs/open.c +1 -1
@@ -1173,7 +1173,7 @@ struct file *dentry_create(const struct path *path, int flags, umode_t mode, error =vfs_create (mnt_idmap (path->mnt),d_inode (path->dentry->d_parent), - path->dentry, mode, true); + path->dentry, mode, true,NULL );if (!error) error =vfs_open (path, f);
fs/overlayfs/overlayfs.h +1 -1
@@ -235,7 +235,7 @@ static inline int ovl_do_create(struct ovl_fs *ofs, struct inode *dir, struct dentry *dentry, umode_t mode) { - int err = vfs_create(ovl_upper_mnt_idmap(ofs), dir, dentry, mode, true); + int err = vfs_create(ovl_upper_mnt_idmap(ofs), dir, dentry, mode, true, NULL);pr_debug ("create(%pd2, 0%o) = %i\n" , dentry, mode, err);return err;
fs/smb/server/vfs.c +1 -1
@@ -189,7 +189,7 @@ int ksmbd_vfs_create(struct ksmbd_work *work, const char *name, umode_t mode) mode |=S_IFREG ; err =vfs_create (mnt_idmap (path.mnt),d_inode (path.dentry), - dentry, mode, true); + dentry, mode, true,NULL );if (!err) {ksmbd_vfs_inherit_owner (work,d_inode (path.dentry),d_inode (dentry));
include/linux/fs.h +1 -1
@@ -2111,7 +2111,7 @@ bool inode_owner_or_capable(struct mnt_idmap *idmap,* VFS helper functions.. */ int vfs_create (struct mnt_idmap *,struct inode *, -struct dentry *,umode_t ,bool ); +struct dentry *,umode_t ,bool ,struct inode **);struct dentry *vfs_mkdir (struct mnt_idmap *,struct inode *,struct dentry *,umode_t ,struct inode **); int vfs_mknod(struct mnt_idmap *, struct inode *, struct dentry *,
Signature · 1 line
2.51.0
Christian Brauner
maintainerRe: [PATCH v3 06/13] vfs: make vfs_create break delegations on parent directory
Quoted 27 lines · Jeff Layton
In order to add directory delegation support, we need to break delegations on the parent whenever there is going to be a change in the directory.
Add a
delegated_inodeparameter tovfs_create. Most callers are converted to pass in NULL, butdo_mknodat()is changed to wait for a delegation break if there is one.Reviewed-by Jan Kara <[email protected]>Reviewed-by NeilBrown <[email protected]>Signed-off-by Jeff Layton <[email protected]>--- fs/ecryptfs/inode.c | 2 +- fs/namei.c | 26 +++++++++++++++++++------- fs/nfsd/nfs3proc.c | 2 +- fs/nfsd/vfs.c | 3 +-- fs/open.c | 2 +- fs/overlayfs/overlayfs.h | 2 +- fs/smb/server/vfs.c | 2 +- include/linux/fs.h | 2 +- 8 files changed, 26 insertions(+), 15 deletions(-)fs/ecryptfs/inode.c +0
-0
fs/ecryptfs/inode.c ecryptfs_do_create(struct inode *directory_inode, · line 192
Quoted 5 lines
fs/ecryptfs/inode.c +1
-1@@ -189,7 +189,7 @@ ecryptfs_do_create(struct inode *directory_inode, rc =lock_parent (ecryptfs_dentry, &lower_dentry, &lower_dir);if (!rc) rc =vfs_create (&nop_mnt_idmap, lower_dir, - lower_dentry, mode, true); + lower_dentry, mode, true,NULL );
Starts to look like we should epxlore whether a struct create_args (or some other name) similar to struct renamedata I did some years ago would help make the code a bit more legible in the future.
Jeff Layton
maintainerRe: [PATCH v3 06/13] vfs: make vfs_create break delegations on parent directory
Quoted 23 lines · Christian Brauner
Quoted 22 lines · Jeff Layton
In order to add directory delegation support, we need to break delegations on the parent whenever there is going to be a change in the directory.
Add a
delegated_inodeparameter tovfs_create. Most callers are converted to pass in NULL, butdo_mknodat()is changed to wait for a delegation break if there is one.Reviewed-by Jan Kara <[email protected]>Reviewed-by NeilBrown <[email protected]>Signed-off-by Jeff Layton <[email protected]>--- fs/ecryptfs/inode.c | 2 +- fs/namei.c | 26 +++++++++++++++++++------- fs/nfsd/nfs3proc.c | 2 +- fs/nfsd/vfs.c | 3 +-- fs/open.c | 2 +- fs/overlayfs/overlayfs.h | 2 +- fs/smb/server/vfs.c | 2 +- include/linux/fs.h | 2 +- 8 files changed, 26 insertions(+), 15 deletions(-)
Quoted 14 lines
fs/ecryptfs/inode.c ecryptfs_do_create(struct inode *directory_inode, · line 192
Quoted 10 lines
fs/ecryptfs/inode.c +1
-1@@ -189,7 +189,7 @@ ecryptfs_do_create(struct inode *directory_inode, rc =lock_parent (ecryptfs_dentry, &lower_dentry, &lower_dir);if (!rc) rc =vfs_create (&nop_mnt_idmap, lower_dir, - lower_dentry, mode, true); + lower_dentry, mode, true,NULL );Starts to look like we should epxlore whether a struct
create_args(or some other name) similar to struct renamedata I did some years ago would help make the code a bit more legible in the future.
I like that idea. Let me see if I can rework this patch along those lines. I'll plan to send an updated set.
Thanks,
Signature · 1 line
Jeff Layton <[email protected]>
Jeff Layton
maintainerPATCH v3 7/13 vfs: make vfs_mknod break delegations on parent directory
In reply to Jeff LaytonIn order to add directory delegation support, we need to break delegations on the parent whenever there is going to be a change in the directory.
Add a new delegated_inode return pointer to vfs_mknod() and have the appropriate callers wait when there is an outstanding delegation. All other callers just set the pointer to NULL.
--- drivers/base/devtmpfs.c | 2 +- fs/ecryptfs/inode.c | 2 +- fs/init.c | 2 +- fs/namei.c | 25 +++++++++++++++++-------- fs/nfsd/vfs.c | 2 +- fs/overlayfs/overlayfs.h | 2 +- include/linux/fs.h | 4 ++-- net/unix/af_unix.c | 2 +- 8 files changed, 25 insertions(+), 16 deletions(-)
drivers/base/devtmpfs.c +1 -1
@@ -231,7 +231,7 @@ static int handle_create(const char *nodename, umode_t mode, kuid_t uid,return PTR_ERR (dentry); err =vfs_mknod (&nop_mnt_idmap,d_inode (path.dentry), dentry, mode, - dev->devt); + dev->devt,NULL );if (!err) {struct iattr newattrs;
fs/ecryptfs/inode.c +1 -1
@@ -565,7 +565,7 @@ ecryptfs_mknod(struct mnt_idmap *idmap, struct inode *dir, rc =lock_parent (dentry, &lower_dentry, &lower_dir);if (!rc) rc =vfs_mknod (&nop_mnt_idmap, lower_dir, - lower_dentry, mode, dev); + lower_dentry, mode, dev,NULL );if (rc ||d_really_is_negative (lower_dentry)) goto out; rc =ecryptfs_interpose (lower_dentry, dentry, dir->i_sb);
fs/init.c +1 -1
@@ -157,7 +157,7 @@ int __init init_mknod(const char *filename, umode_t mode, unsigned int dev) error =security_path_mknod (&path, dentry, mode, dev);if (!error) error =vfs_mknod (mnt_idmap (path.mnt), path.dentry->d_inode, - dentry, mode,new_decode_dev (dev)); + dentry, mode,new_decode_dev (dev),NULL );end_creating_path (&path, dentry);return error; }
fs/namei.c +17 -8
@@ -4297,13 +4297,15 @@ inline struct dentry *start_creating_user_path( }EXPORT_SYMBOL (start_creating_user_path); +/** * vfs_mknod - create device node or file -* @idmap: idmap of the mount the inode was found from -* @dir: inode of the parent directory -* @dentry: dentry of the child device node -* @mode: mode of the child device node -* @dev: device number of device to create +* @idmap: idmap of the mount the inode was found from +* @dir: inode of the parent directory +* @dentry: dentry of the child device node +* @mode: mode of the child device node +* @dev: device number of device to create +* @delegated_inode: returns parent inode, if the inode is delegated. * * Create a device node or file. *
@@ -4314,7 +4316,8 @@ EXPORT_SYMBOL(start_creating_user_path);* raw inode simply pass @nop_mnt_idmap. */ int vfs_mknod (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,umode_t mode,dev_t dev) +struct dentry *dentry,umode_t mode,dev_t dev, +struct inode **delegated_inode) {bool is_whiteout =S_ISCHR (mode) && dev ==WHITEOUT_DEV ;int error =may_create (idmap, dir, dentry);
@@ -4338,6 +4341,10 @@ int vfs_mknod(struct mnt_idmap *idmap, struct inode *dir,if (error)return error; + error =try_break_deleg (dir, delegated_inode); +if (error) +return error; + error = dir->i_op->mknod (idmap, dir, dentry, mode, dev);if (!error)fsnotify_create (dir, dentry);
@@ -4397,11 +4404,13 @@ static int do_mknodat(int dfd, struct filename *name, umode_t mode,break ;case S_IFCHR :case S_IFBLK : error =vfs_mknod (idmap, path.dentry->d_inode, - dentry, mode,new_decode_dev (dev)); + dentry, mode,new_decode_dev (dev), + &delegated_inode);break ;case S_IFIFO :case S_IFSOCK : error =vfs_mknod (idmap, path.dentry->d_inode, - dentry, mode,0 ); + dentry, mode,0 , + &delegated_inode);break ; } out2:
fs/nfsd/vfs.c +1 -1
@@ -1660,7 +1660,7 @@ nfsd_create_locked(struct svc_rqst *rqstp, struct svc_fh *fhp,case S_IFIFO :case S_IFSOCK : host_err =vfs_mknod (&nop_mnt_idmap, dirp, dchild, - iap->ia_mode, rdev); + iap->ia_mode, rdev,NULL );break ;default : printk(KERN_WARNING "nfsd: bad file type %o in nfsd_create\n",
fs/overlayfs/overlayfs.h +1 -1
@@ -257,7 +257,7 @@ static inline int ovl_do_mknod(struct ovl_fs *ofs, struct inode *dir, struct dentry *dentry, umode_t mode, dev_t dev) { - int err = vfs_mknod(ovl_upper_mnt_idmap(ofs), dir, dentry, mode, dev); + int err = vfs_mknod(ovl_upper_mnt_idmap(ofs), dir, dentry, mode, dev, NULL);pr_debug ("mknod(%pd2, 0%o, 0%o) = %i\n" , dentry, mode, dev, err);return err;
include/linux/fs.h +2 -2
@@ -2115,7 +2115,7 @@ int vfs_create(struct mnt_idmap *, struct inode *,struct dentry *vfs_mkdir (struct mnt_idmap *,struct inode *,struct dentry *,umode_t ,struct inode **);int vfs_mknod (struct mnt_idmap *,struct inode *,struct dentry *, -umode_t ,dev_t ); +umode_t ,dev_t ,struct inode **);int vfs_symlink (struct mnt_idmap *,struct inode *,struct dentry *,const char *); int vfs_link(struct dentry *, struct mnt_idmap *, struct inode *,
@@ -2151,7 +2151,7 @@ static inline int vfs_whiteout(struct mnt_idmap *idmap, struct inode *dir, struct dentry *dentry) { return vfs_mknod(idmap, dir, dentry, S_IFCHR | WHITEOUT_MODE, -WHITEOUT_DEV ); +WHITEOUT_DEV ,NULL ); } struct file *kernel_tmpfile_open(struct mnt_idmap *idmap,
net/unix/af_unix.c +1 -1
@@ -1399,7 +1399,7 @@ static int unix_bind_bsd(struct sock *sk, struct sockaddr_un *sunaddr, idmap =mnt_idmap (parent.mnt); err =security_path_mknod (&parent, dentry, mode,0 );if (!err) - err =vfs_mknod (idmap,d_inode (parent.dentry), dentry, mode,0 ); + err =vfs_mknod (idmap,d_inode (parent.dentry), dentry, mode,0 ,NULL );if (err) goto out_path; err =mutex_lock_interruptible (&u->bindlock);
Signature · 1 line
2.51.0
Jeff Layton
maintainerPATCH v3 8/13 vfs: make vfs_symlink break delegations on parent dir
In reply to Jeff LaytonIn order to add directory delegation support, we must break delegations on the parent on any change to the directory.
Add a delegated_inode parameter to vfs_symlink() and have it break the delegation. do_symlinkat() can then wait on the delegation break before proceeding.
--- fs/ecryptfs/inode.c | 2 +- fs/init.c | 2 +- fs/namei.c | 16 ++++++++++++++-- fs/nfsd/vfs.c | 2 +- fs/overlayfs/overlayfs.h | 2 +- include/linux/fs.h | 2 +- 6 files changed, 19 insertions(+), 7 deletions(-)
fs/ecryptfs/inode.c +1 -1
@@ -480,7 +480,7 @@ static int ecryptfs_symlink(struct mnt_idmap *idmap,if (rc) goto out_lock; rc =vfs_symlink (&nop_mnt_idmap, lower_dir, lower_dentry, - encoded_symname); + encoded_symname,NULL );kfree (encoded_symname);if (rc ||d_really_is_negative (lower_dentry)) goto out_lock;
fs/init.c +1 -1
@@ -209,7 +209,7 @@ int __init init_symlink(const char *oldname, const char *newname) error =security_path_symlink (&path, dentry, oldname);if (!error) error =vfs_symlink (mnt_idmap (path.mnt), path.dentry->d_inode, - dentry, oldname); + dentry, oldname,NULL );end_creating_path (&path, dentry);return error; }
fs/namei.c +14 -2
@@ -4851,6 +4851,7 @@ SYSCALL_DEFINE1(unlink, const char __user *, pathname)* @dir: inode of the parent directory * @dentry: dentry of the child symlink file * @oldname: name of the file to link to +* @delegated_inode: returns victim inode, if the inode is delegated. * * Create a symlink. *
@@ -4861,7 +4862,8 @@ SYSCALL_DEFINE1(unlink, const char __user *, pathname)* raw inode simply pass @nop_mnt_idmap. */ int vfs_symlink (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,const char *oldname) +struct dentry *dentry,const char *oldname, +struct inode **delegated_inode) {int error;
@@ -4876,6 +4878,10 @@ int vfs_symlink(struct mnt_idmap *idmap, struct inode *dir,if (error)return error; + error =try_break_deleg (dir, delegated_inode); +if (error) +return error; + error = dir->i_op->symlink (idmap, dir, dentry, oldname);if (!error)fsnotify_create (dir, dentry);
@@ -4889,6 +4895,7 @@ int do_symlinkat(struct filename *from, int newdfd, struct filename *to)struct dentry *dentry;struct path path;unsigned int lookup_flags =0 ; +struct inode *delegated_inode =NULL ;if (IS_ERR (from)) { error =PTR_ERR (from);
@@ -4903,8 +4910,13 @@ int do_symlinkat(struct filename *from, int newdfd, struct filename *to) error =security_path_symlink (&path, dentry, from->name);if (!error) error =vfs_symlink (mnt_idmap (path.mnt), path.dentry->d_inode, - dentry, from->name); + dentry, from->name, &delegated_inode);end_creating_path (&path, dentry); +if (delegated_inode) { + error =break_deleg_wait (&delegated_inode); +if (!error) + goto retry; + }if (retry_estale (error, lookup_flags)) { lookup_flags |=LOOKUP_REVAL ; goto retry;
fs/nfsd/vfs.c +1 -1
@@ -1829,7 +1829,7 @@ nfsd_symlink(struct svc_rqst *rqstp, struct svc_fh *fhp, err =fh_fill_pre_attrs (fhp);if (err != nfs_ok) goto out_unlock; - host_err =vfs_symlink (&nop_mnt_idmap,d_inode (dentry), dnew, path); + host_err =vfs_symlink (&nop_mnt_idmap,d_inode (dentry), dnew, path,NULL ); err =nfserrno (host_err); cerr =fh_compose (resfhp, fhp->fh_export, dnew, fhp);if (!err)
fs/overlayfs/overlayfs.h +1 -1
@@ -267,7 +267,7 @@ static inline int ovl_do_symlink(struct ovl_fs *ofs, struct inode *dir, struct dentry *dentry, const char *oldname) { - int err = vfs_symlink(ovl_upper_mnt_idmap(ofs), dir, dentry, oldname); + int err = vfs_symlink(ovl_upper_mnt_idmap(ofs), dir, dentry, oldname, NULL);pr_debug ("symlink(\"%s\", %pd2) = %i\n" , oldname, dentry, err);return err;
include/linux/fs.h +1 -1
@@ -2117,7 +2117,7 @@ struct dentry *vfs_mkdir(struct mnt_idmap *, struct inode *,int vfs_mknod (struct mnt_idmap *,struct inode *,struct dentry *,umode_t ,dev_t ,struct inode **);int vfs_symlink (struct mnt_idmap *,struct inode *, -struct dentry *,const char *); +struct dentry *,const char *,struct inode **);int vfs_link (struct dentry *,struct mnt_idmap *,struct inode *,struct dentry *,struct inode **); int vfs_rmdir(struct mnt_idmap *, struct inode *, struct dentry *,
Signature · 1 line
2.51.0
Re: [PATCH v3 08/13] vfs: make vfs_symlink break delegations on parent dir
Quoted 8 lines · Jeff Layton
In order to add directory delegation support, we must break delegations on the parent on any change to the directory.
Add a
delegated_inodeparameter tovfs_symlink()and have it break the delegation.do_symlinkat()can then wait on the delegation break before proceeding.Signed-off-by Jeff Layton <[email protected]>
Looks good. Feel free to add:
Honza
Quoted 134 lines
--- fs/ecryptfs/inode.c | 2 +- fs/init.c | 2 +- fs/namei.c | 16 ++++++++++++++-- fs/nfsd/vfs.c | 2 +- fs/overlayfs/overlayfs.h | 2 +- include/linux/fs.h | 2 +- 6 files changed, 19 insertions(+), 7 deletions(-)fs/ecryptfs/inode.c +1
-1@@ -480,7 +480,7 @@ static int ecryptfs_symlink(struct mnt_idmap *idmap,if (rc) goto out_lock; rc =vfs_symlink (&nop_mnt_idmap, lower_dir, lower_dentry, - encoded_symname); + encoded_symname,NULL );kfree (encoded_symname);if (rc ||d_really_is_negative (lower_dentry)) goto out_lock;fs/init.c +1
-1@@ -209,7 +209,7 @@ int __init init_symlink(const char *oldname, const char *newname) error =security_path_symlink (&path, dentry, oldname);if (!error) error =vfs_symlink (mnt_idmap (path.mnt), path.dentry->d_inode, - dentry, oldname); + dentry, oldname,NULL );end_creating_path (&path, dentry);return error; }fs/namei.c +14
-2@@ -4851,6 +4851,7 @@ SYSCALL_DEFINE1(unlink, const char __user *, pathname)* @dir: inode of the parent directory * @dentry: dentry of the child symlink file * @oldname: name of the file to link to +* @delegated_inode: returns victim inode, if the inode is delegated. * * Create a symlink. * @@ -4861,7 +4862,8 @@ SYSCALL_DEFINE1(unlink, const char __user *, pathname)* raw inode simply pass @nop_mnt_idmap. */ int vfs_symlink (struct mnt_idmap *idmap,struct inode *dir, -struct dentry *dentry,const char *oldname) +struct dentry *dentry,const char *oldname, +struct inode **delegated_inode) {int error;@@ -4876,6 +4878,10 @@ int vfs_symlink(struct mnt_idmap *idmap, struct inode *dir,if (error)return error; + error =try_break_deleg (dir, delegated_inode); +if (error) +return error; + error = dir->i_op->symlink (idmap, dir, dentry, oldname);if (!error)fsnotify_create (dir, dentry);@@ -4889,6 +4895,7 @@ int do_symlinkat(struct filename *from, int newdfd, struct filename *to)struct dentry *dentry;struct path path;unsigned int lookup_flags =0 ; +struct inode *delegated_inode =NULL ;if (IS_ERR (from)) { error =PTR_ERR (from);@@ -4903,8 +4910,13 @@ int do_symlinkat(struct filename *from, int newdfd, struct filename *to) error =security_path_symlink (&path, dentry, from->name);if (!error) error =vfs_symlink (mnt_idmap (path.mnt), path.dentry->d_inode, - dentry, from->name); + dentry, from->name, &delegated_inode);end_creating_path (&path, dentry); +if (delegated_inode) { + error =break_deleg_wait (&delegated_inode); +if (!error) + goto retry; + }if (retry_estale (error, lookup_flags)) { lookup_flags |=LOOKUP_REVAL ; goto retry;fs/nfsd/vfs.c +1
-1@@ -1829,7 +1829,7 @@ nfsd_symlink(struct svc_rqst *rqstp, struct svc_fh *fhp, err =fh_fill_pre_attrs (fhp);if (err != nfs_ok) goto out_unlock; - host_err =vfs_symlink (&nop_mnt_idmap,d_inode (dentry), dnew, path); + host_err =vfs_symlink (&nop_mnt_idmap,d_inode (dentry), dnew, path,NULL ); err =nfserrno (host_err); cerr =fh_compose (resfhp, fhp->fh_export, dnew, fhp);if (!err)fs/overlayfs/overlayfs.h +1
-1@@ -267,7 +267,7 @@ static inline int ovl_do_symlink(struct ovl_fs *ofs, struct inode *dir, struct dentry *dentry, const char *oldname) { - int err = vfs_symlink(ovl_upper_mnt_idmap(ofs), dir, dentry, oldname); + int err = vfs_symlink(ovl_upper_mnt_idmap(ofs), dir, dentry, oldname, NULL);pr_debug ("symlink(\"%s\", %pd2) = %i\n" , oldname, dentry, err);return err;include/linux/fs.h +1
-1@@ -2117,7 +2117,7 @@ struct dentry *vfs_mkdir(struct mnt_idmap *, struct inode *,int vfs_mknod (struct mnt_idmap *,struct inode *,struct dentry *,umode_t ,dev_t ,struct inode **);int vfs_symlink (struct mnt_idmap *,struct inode *, -struct dentry *,const char *); +struct dentry *,const char *,struct inode **);int vfs_link (struct dentry *,struct mnt_idmap *,struct inode *,struct dentry *,struct inode **); int vfs_rmdir(struct mnt_idmap *, struct inode *, struct dentry *,Signature · 2 lines
-- 2.51.0
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Jeff Layton
maintainerPATCH v3 9/13 filelock: lift the ban on directory leases in generic_setlease
In reply to Jeff LaytonWith the addition of the try_break_lease calls in directory changing operations, allow generic_setlease to hand them out. Write leases on directories are never allowed however, so continue to reject them.
For now, there is no API for requesting delegations from userland, so ensure that userland is prevented from acquiring a lease on a directory.
--- fs/locks.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
fs/locks.c +10 -2
@@ -1929,14 +1929,19 @@ static int generic_delete_lease(struct file *filp, void *owner)int generic_setlease (struct file *filp,int arg,struct file_lease **flp,void **priv) { -if (!S_ISREG (file_inode (filp)->i_mode)) +struct inode *inode =file_inode (filp); + +if (!S_ISREG (inode->i_mode) && !S_ISDIR (inode->i_mode))return -EINVAL ;switch (arg) {case F_UNLCK :return generic_delete_lease (filp, *priv); -case F_RDLCK :case F_WRLCK : +if (S_ISDIR (inode->i_mode)) +return -EINVAL ; + fallthrough; +case F_RDLCK :if (!(*flp)->fl_lmops->lm_break) {WARN_ON_ONCE (1 );return -ENOLCK ;
@@ -2065,6 +2070,9 @@ static int do_fcntl_add_lease(unsigned int fd, struct file *filp, int arg)*/ int fcntl_setlease (unsigned int fd,struct file *filp,int arg) { +if (S_ISDIR (file_inode (filp)->i_mode)) +return -EINVAL ; +if (arg ==F_UNLCK )return vfs_setlease (filp,F_UNLCK ,NULL , (void **)&filp);return do_fcntl_add_lease (fd, filp, arg);
Signature · 1 line
2.51.0
Re: [PATCH v3 09/13] filelock: lift the ban on directory leases in generic_setlease
Quoted 9 lines · Jeff Layton
With the addition of the
try_break_leasecalls in directory changing operations, allowgeneric_setleaseto hand them out. Write leases on directories are never allowed however, so continue to reject them.For now, there is no API for requesting delegations from userland, so ensure that userland is prevented from acquiring a lease on a directory.
Reviewed-by NeilBrown <[email protected]>Signed-off-by Jeff Layton <[email protected]>
Looks good. Feel free to add:
Honza
Quoted 44 lines
--- fs/locks.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)fs/locks.c +10
-2@@ -1929,14 +1929,19 @@ static int generic_delete_lease(struct file *filp, void *owner)int generic_setlease (struct file *filp,int arg,struct file_lease **flp,void **priv) { -if (!S_ISREG (file_inode (filp)->i_mode)) +struct inode *inode =file_inode (filp); + +if (!S_ISREG (inode->i_mode) && !S_ISDIR (inode->i_mode))return -EINVAL ;switch (arg) {case F_UNLCK :return generic_delete_lease (filp, *priv); -case F_RDLCK :case F_WRLCK : +if (S_ISDIR (inode->i_mode)) +return -EINVAL ; + fallthrough; +case F_RDLCK :if (!(*flp)->fl_lmops->lm_break) {WARN_ON_ONCE (1 );return -ENOLCK ;@@ -2065,6 +2070,9 @@ static int do_fcntl_add_lease(unsigned int fd, struct file *filp, int arg)*/ int fcntl_setlease (unsigned int fd,struct file *filp,int arg) { +if (S_ISDIR (file_inode (filp)->i_mode)) +return -EINVAL ; +if (arg ==F_UNLCK )return vfs_setlease (filp,F_UNLCK ,NULL , (void **)&filp);return do_fcntl_add_lease (fd, filp, arg);Signature · 2 lines
-- 2.51.0
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR
Jeff Layton
maintainerPATCH v3 10/13 nfsd: allow filecache to hold S_IFDIR files
In reply to Jeff LaytonThe filecache infrastructure will only handle S_IFREG files at the moment. Directory delegations will require adding support for opening S_IFDIR inodes.
Plumb a "type" argument into nfsd_file_do_acquire() and have all of the existing callers set it to S_IFREG. Add a new nfsd_file_acquire_dir() wrapper that nfsd can call to request a nfsd_file that holds a directory open.
For now, there is no need for a fsnotify_mark for directories, as CB_NOTIFY is not yet supported. Change nfsd_file_do_acquire() to avoid allocating one for non-S_IFREG inodes.
--- fs/nfsd/filecache.c | 57 ++++++++++++++++++++++++++++++++++++++++------------- fs/nfsd/filecache.h | 2 ++ fs/nfsd/vfs.c | 5 +++-- fs/nfsd/vfs.h | 2 +- 4 files changed, 49 insertions(+), 17 deletions(-)
fs/nfsd/filecache.c +43 -14
@@ -1086,7 +1086,7 @@ nfsd_file_do_acquire(struct svc_rqst *rqstp, struct net *net,struct auth_domain *client, struct svc_fh *fhp, unsigned int may_flags, struct file *file, - struct nfsd_file **pnf, bool want_gc) + umode_t type, bool want_gc, struct nfsd_file **pnf) { unsigned char need = may_flags & NFSD_FILE_MAY_MASK;struct nfsd_file *new, *nf;
@@ -1097,13 +1097,13 @@ nfsd_file_do_acquire(struct svc_rqst *rqstp, struct net *net,int ret; retry: -if (rqstp) { - status =fh_verify (rqstp, fhp,S_IFREG , +if (rqstp) + status =fh_verify (rqstp, fhp, type, may_flags|NFSD_MAY_OWNER_OVERRIDE ); - }else { - status =fh_verify_local (net, cred, client, fhp,S_IFREG , +else + status =fh_verify_local (net, cred, client, fhp, type, may_flags|NFSD_MAY_OWNER_OVERRIDE ); - } +if (status != nfs_ok)return status; inode =d_inode (fhp->fh_dentry);
@@ -1176,15 +1176,18 @@ nfsd_file_do_acquire(struct svc_rqst *rqstp, struct net *net, open_file:trace_nfsd_file_alloc (nf); - nf->nf_mark =nfsd_file_mark_find_or_create (inode); -if (nf->nf_mark) { + +if (type ==S_IFREG ) + nf->nf_mark =nfsd_file_mark_find_or_create (inode); + +if (type !=S_IFREG || nf->nf_mark) {if (file) {get_file (file); nf->nf_file = file; status = nfs_ok;trace_nfsd_file_opened (nf, status); }else { - ret =nfsd_open_verified (fhp, may_flags, &nf->nf_file); + ret =nfsd_open_verified (fhp, type, may_flags, &nf->nf_file);if (ret == -EOPENSTALE && stale_retry) { stale_retry = false;nfsd_file_unhash (nf);
@@ -1246,7 +1249,7 @@ nfsd_file_acquire_gc(struct svc_rqst *rqstp, struct svc_fh *fhp, unsigned int may_flags, struct nfsd_file **pnf) { return nfsd_file_do_acquire(rqstp, SVC_NET(rqstp), NULL, NULL, -fhp ,may_flags ,NULL ,pnf ,true ); +fhp ,may_flags ,NULL ,S_IFREG ,true ,pnf ); }/**
@@ -1271,7 +1274,7 @@ nfsd_file_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp, unsigned int may_flags, struct nfsd_file **pnf) { return nfsd_file_do_acquire(rqstp, SVC_NET(rqstp), NULL, NULL, -fhp ,may_flags ,NULL ,pnf ,false ); +fhp ,may_flags ,NULL ,S_IFREG ,false ,pnf ); }/**
@@ -1314,8 +1317,8 @@ nfsd_file_acquire_local(struct net *net, struct svc_cred *cred,const struct cred *save_cred =get_current_cred ();__be32 beres; - beres =nfsd_file_do_acquire (NULL , net, cred, client, - fhp, may_flags,NULL , pnf, false); + beres =nfsd_file_do_acquire (NULL , net, cred, client, fhp, may_flags, +NULL ,S_IFREG , false, pnf);put_cred (revert_creds (save_cred));return beres; }
@@ -1344,7 +1347,33 @@ nfsd_file_acquire_opened(struct svc_rqst *rqstp, struct svc_fh *fhp, struct nfsd_file **pnf) {return nfsd_file_do_acquire (rqstp,SVC_NET (rqstp),NULL ,NULL , - fhp, may_flags, file, pnf, false); + fhp, may_flags, file,S_IFREG , false, pnf); +} + +/** +* nfsd_file_acquire_dir - Get a struct nfsd_file with an open directory +* @rqstp: the RPC transaction being executed +* @fhp: the NFS filehandle of the file to be opened +* @pnf: OUT: new or found "struct nfsd_file" object +* +* The nfsd_file_object returned by this API is reference-counted +* but not garbage-collected. The object is unhashed after the +* final nfsd_file_put(). This opens directories only, and only +* in O_RDONLY mode. +* +* Return values: +* %nfs_ok - @pnf points to an nfsd_file with its reference +* count boosted. +* +* On error, an nfsstat value in network byte order is returned. +*/ +__be32 +nfsd_file_acquire_dir (struct svc_rqst *rqstp,struct svc_fh *fhp, +struct nfsd_file **pnf) +{ +return nfsd_file_do_acquire (rqstp,SVC_NET (rqstp),NULL ,NULL , fhp, +NFSD_MAY_READ |NFSD_MAY_64BIT_COOKIE , +NULL ,S_IFDIR , false, pnf); }/*
fs/nfsd/filecache.h +2 -0
@@ -82,5 +82,7 @@ __be32 nfsd_file_acquire_opened(struct svc_rqst *rqstp, struct svc_fh *fhp,__be32 nfsd_file_acquire_local (struct net *net,struct svc_cred *cred,struct auth_domain *client,struct svc_fh *fhp,unsigned int may_flags,struct nfsd_file **pnf); +__be32 nfsd_file_acquire_dir (struct svc_rqst *rqstp,struct svc_fh *fhp, +struct nfsd_file **pnf);int nfsd_file_cache_stats_show (struct seq_file *m,void *v);#endif /* _FS_NFSD_FILECACHE_H */
fs/nfsd/vfs.c +3 -2
@@ -959,15 +959,16 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, umode_t type,/** * nfsd_open_verified - Open a regular file for the filecache * @fhp: NFS filehandle of the file to open +* @type: S_IFMT inode type allowed (0 means any type is allowed) * @may_flags: internal permission flags * @filp: OUT: open "struct file *" * * Returns zero on success, or a negative errno value. */ int -nfsd_open_verified (struct svc_fh *fhp,int may_flags,struct file **filp) +nfsd_open_verified (struct svc_fh *fhp,umode_t type,int may_flags,struct file **filp) { -return __nfsd_open (fhp,S_IFREG , may_flags, filp); +return __nfsd_open (fhp, type, may_flags, filp); }/*
fs/nfsd/vfs.h +1 -1
@@ -114,7 +114,7 @@ __be32 nfsd_setxattr(struct svc_rqst *rqstp, struct svc_fh *fhp,int nfsd_open_break_lease (struct inode *,int );__be32 nfsd_open (struct svc_rqst *,struct svc_fh *,umode_t ,int ,struct file **); -int nfsd_open_verified (struct svc_fh *fhp,int may_flags, +int nfsd_open_verified (struct svc_fh *fhp,umode_t type,int may_flags,struct file **filp); __be32 nfsd_splice_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, loff_t offset,
Signature · 1 line
2.51.0
Jeff Layton
maintainerPATCH v3 11/13 nfsd: allow DELEGRETURN on directories
In reply to Jeff LaytonAs Trond pointed out: "...provided that the presented stateid is actually valid, it is also sufficient to uniquely identify the file to which it is associated (see RFC8881 Section 8.2.4), so the filehandle should be considered mostly irrelevant for operations like DELEGRETURN."
Don't ask fh_verify to filter on file type.
--- fs/nfsd/nfs4state.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/nfsd/nfs4state.c +2 -1
@@ -7832,7 +7832,8 @@ nfsd4_delegreturn(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,__be32 status;struct nfsd_net *nn =net_generic (SVC_NET (rqstp), nfsd_net_id); -if ((status =fh_verify (rqstp, &cstate->current_fh,S_IFREG ,0 ))) + status =fh_verify (rqstp, &cstate->current_fh,0 ,0 ); +if (status)return status; status =nfsd4_lookup_stateid (cstate, stateid,SC_TYPE_DELEG ,SC_STATUS_REVOKED , &s, nn);
Signature · 1 line
2.51.0
Jeff Layton
maintainerPATCH v3 12/13 nfsd: wire up GET_DIR_DELEGATION handling
In reply to Jeff LaytonAdd a new routine for acquiring a read delegation on a directory. These are recallable-only delegations with no support for CB_NOTIFY. That will be added in a later phase.
Since the same CB_RECALL/DELEGRETURN infrastructure is used for regular and directory delegations, a normal nfs4_delegation is used to represent a directory delegation.
--- fs/nfsd/nfs4proc.c | 22 +++++++++++- fs/nfsd/nfs4state.c | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++ fs/nfsd/state.h | 5 +++ 3 files changed, 126 insertions(+), 1 deletion(-)
fs/nfsd/nfs4proc.c +21 -1
@@ -2342,6 +2342,13 @@ nfsd4_get_dir_delegation(struct svc_rqst *rqstp, union nfsd4_op_u *u) {struct nfsd4_get_dir_delegation *gdd = &u->get_dir_delegation; +struct nfs4_delegation *dd; +struct nfsd_file *nf; +__be32 status; + + status =nfsd_file_acquire_dir (rqstp, &cstate->current_fh, &nf); +if (status != nfs_ok) +return status;/* * RFC 8881, section 18.39.3 says:
@@ -2355,7 +2362,20 @@ nfsd4_get_dir_delegation(struct svc_rqst *rqstp,* return NFS4_OK with a non-fatal status of GDD4_UNAVAIL in this * situation. */ - gdd->gddrnf_status =GDD4_UNAVAIL ; + dd =nfsd_get_dir_deleg (cstate, gdd, nf); +nfsd_file_put (nf); +if (IS_ERR (dd)) { +int err =PTR_ERR (dd); + +if (err != -EAGAIN ) +return nfserrno (err); + gdd->gddrnf_status =GDD4_UNAVAIL ; +return nfs_ok; + } + + gdd->gddrnf_status =GDD4_OK ; +memcpy (&gdd->gddr_stateid, &dd->dl_stid.sc_stateid,sizeof (gdd->gddr_stateid)); +nfs4_put_stid (&dd->dl_stid);return nfs_ok; }
fs/nfsd/nfs4state.c +100 -0
103 lines not on this page · raw message
fs/nfsd/state.h +5 -0
@@ -867,4 +867,9 @@ static inline bool try_to_expire_client(struct nfs4_client *clp)extern __be32 nfsd4_deleg_getattr_conflict (struct svc_rqst *rqstp,struct dentry *dentry,struct nfs4_delegation **pdp); + +struct nfsd4_get_dir_delegation ; +struct nfs4_delegation *nfsd_get_dir_deleg (struct nfsd4_compound_state *cstate, +struct nfsd4_get_dir_delegation *gdd, +struct nfsd_file *nf);#endif /* NFSD4_STATE_H */
Signature · 1 line
2.51.0
Re: [PATCH v3 12/13] nfsd: wire up GET_DIR_DELEGATION handling
Quoted 170 lines · Jeff Layton
Add a new routine for acquiring a read delegation on a directory. These are recallable-only delegations with no support for
CB_NOTIFY. That will be added in a later phase.Since the same CB_RECALL/DELEGRETURN infrastructure is used for regular and directory delegations, a normal
nfs4_delegationis used to represent a directory delegation.Reviewed-by NeilBrown <[email protected]>Signed-off-by Jeff Layton <[email protected]>--- fs/nfsd/nfs4proc.c | 22 +++++++++++- fs/nfsd/nfs4state.c | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++ fs/nfsd/state.h | 5 +++ 3 files changed, 126 insertions(+), 1 deletion(-)fs/nfsd/nfs4proc.c +21
-1@@ -2342,6 +2342,13 @@ nfsd4_get_dir_delegation(struct svc_rqst *rqstp, union nfsd4_op_u *u) {struct nfsd4_get_dir_delegation *gdd = &u->get_dir_delegation; +struct nfs4_delegation *dd; +struct nfsd_file *nf; +__be32 status; + + status =nfsd_file_acquire_dir (rqstp, &cstate->current_fh, &nf); +if (status != nfs_ok) +return status;/* * RFC 8881, section 18.39.3 says: @@ -2355,7 +2362,20 @@ nfsd4_get_dir_delegation(struct svc_rqst *rqstp,* return NFS4_OK with a non-fatal status of GDD4_UNAVAIL in this * situation. */ - gdd->gddrnf_status =GDD4_UNAVAIL ; + dd =nfsd_get_dir_deleg (cstate, gdd, nf); +nfsd_file_put (nf); +if (IS_ERR (dd)) { +int err =PTR_ERR (dd); + +if (err != -EAGAIN ) +return nfserrno (err); + gdd->gddrnf_status =GDD4_UNAVAIL ; +return nfs_ok; + } + + gdd->gddrnf_status =GDD4_OK ; +memcpy (&gdd->gddr_stateid, &dd->dl_stid.sc_stateid,sizeof (gdd->gddr_stateid)); +nfs4_put_stid (&dd->dl_stid);return nfs_ok; }fs/nfsd/nfs4state.c +100
-0@@ -9367,3 +9367,103 @@ nfsd4_deleg_getattr_conflict(struct svc_rqst *rqstp, struct dentry *dentry,nfs4_put_stid (&dp->dl_stid);return status; } + +/** +* nfsd_get_dir_deleg - attempt to get a directory delegation +* @cstate: compound state +* @gdd: GET_DIR_DELEGATION arg/resp structure +* @nf: nfsd_file opened on the directory +* +* Given a GET_DIR_DELEGATION request @gdd, attempt to acquire a delegation +* on the directory to which @nf refers. Note that this does not set up any +* sort of async notifications for the delegation. +*/ +struct nfs4_delegation * +nfsd_get_dir_deleg (struct nfsd4_compound_state *cstate, +struct nfsd4_get_dir_delegation *gdd, +struct nfsd_file *nf) +{ +struct nfs4_client *clp = cstate->clp; +struct nfs4_delegation *dp; +struct file_lease *fl; +struct nfs4_file *fp, *rfp; +int status =0 ; + + fp =nfsd4_alloc_file (); +if (!fp) +return ERR_PTR (-ENOMEM ); + +nfsd4_file_init (&cstate->current_fh, fp); + + rfp =nfsd4_file_hash_insert (fp, &cstate->current_fh); +if (unlikely (!rfp)) { +put_nfs4_file (fp); +return ERR_PTR (-ENOMEM ); + } + +if (rfp != fp) { +put_nfs4_file (fp); + fp = rfp; + } + +/* if this client already has one, return that it's unavailable */ +spin_lock (&state_lock); +spin_lock (&fp->fi_lock); +/* existing delegation? */ +if (nfs4_delegation_exists (clp, fp)) { + status = -EAGAIN ; + }else if (!fp->fi_deleg_file) { + fp->fi_deleg_file =nfsd_file_get (nf); + fp->fi_delegees =1 ; + }else { + ++fp->fi_delegees; + } +spin_unlock (&fp->fi_lock); +spin_unlock (&state_lock); + +if (status) { +put_nfs4_file (fp); +return ERR_PTR (status); + } + +/* Try to set up the lease */ + status = -ENOMEM ; + dp =alloc_init_deleg (clp, fp,NULL ,NFS4_OPEN_DELEGATE_READ ); +if (!dp) + goto out_delegees; + + fl =nfs4_alloc_init_lease (dp); +if (!fl) + goto out_put_stid; + + status =kernel_setlease (nf->nf_file, + fl->c.flc_type, &fl,NULL ); +if (fl) +locks_free_lease (fl); +if (status) + goto out_put_stid; + +/* +* Now, try to hash it. This can fail if we race another nfsd task +* trying to set a delegation on the same file. If that happens, +* then just say UNAVAIL. +*/ +spin_lock (&state_lock); +spin_lock (&clp->cl_lock); +spin_lock (&fp->fi_lock); + status =hash_delegation_locked (dp, fp); +spin_unlock (&fp->fi_lock); +spin_unlock (&clp->cl_lock); +spin_unlock (&state_lock); + +if (!status) +return dp; + +/* Something failed. Drop the lease and clean up the stid */ +kernel_setlease (fp->fi_deleg_file->nf_file,F_UNLCK ,NULL , (void **)&dp); +out_put_stid: +nfs4_put_stid (&dp->dl_stid); +out_delegees: +put_deleg_file (fp); +return ERR_PTR (status); +}fs/nfsd/state.h +0
-0
fs/nfsd/state.h static inline bool try_to_expire_client(struct nfs4_client *clp) · line 875
Quoted 9 lines
fs/nfsd/state.h +5
-0@@ -867,4 +867,9 @@ static inline bool try_to_expire_client(struct nfs4_client *clp)extern __be32 nfsd4_deleg_getattr_conflict (struct svc_rqst *rqstp,struct dentry *dentry,struct nfs4_delegation **pdp); + +struct nfsd4_get_dir_delegation ; +struct nfs4_delegation *nfsd_get_dir_deleg (struct nfsd4_compound_state *cstate, +struct nfsd4_get_dir_delegation *gdd, +struct nfsd_file *nf);#endif /* NFSD4_STATE_H */
Signature · 1 line
Chuck Lever
Jeff Layton
maintainerPATCH v3 13/13 vfs: expose delegation support to userland
In reply to Jeff LaytonNow that support for recallable directory delegations is complete, expose this functionality to userland with new F_SETDELEG and F_GETDELEG commands for fcntl(). This also allows userland to request a FL_DELEG type lease on files too. Userland applications that do will get signalled when there are metadata changes in addition to just data changes (which is a limitation of FL_LEASE leases).
These commands accept a new "struct delegation" argument that contains a flags field for future expansion.
--- fs/fcntl.c | 9 ++++++++ fs/locks.c | 53 ++++++++++++++++++++++++++++++++++++---------- include/linux/filelock.h | 12 +++++++++++ include/uapi/linux/fcntl.h | 10 +++++++++ 4 files changed, 73 insertions(+), 11 deletions(-)
fs/fcntl.c +9 -0
@@ -445,6 +445,7 @@ static long do_fcntl(int fd, unsigned int cmd, unsigned long arg, struct file *filp) {void __user *argp = (void __user *)arg; +struct delegation deleg;int argi = (int )arg;struct flock flock;long err = -EINVAL ;
@@ -550,6 +551,14 @@ static long do_fcntl(int fd, unsigned int cmd, unsigned long arg,case F_SET_RW_HINT : err =fcntl_set_rw_hint (filp, arg);break ; +case F_GETDELEG : + err =fcntl_getdeleg (filp); +break ; +case F_SETDELEG : +if (copy_from_user (&deleg, argp,sizeof (deleg))) +return -EFAULT ; + err =fcntl_setdeleg (fd, filp, &deleg); +break ;default :break ; }
fs/locks.c +42 -11
119 lines not on this page · raw message
include/linux/filelock.h +12 -0
@@ -159,6 +159,8 @@ int fcntl_setlk64(unsigned int, struct file *, unsigned int,int fcntl_setlease (unsigned int fd,struct file *filp,int arg);int fcntl_getlease (struct file *filp); +int fcntl_setdeleg (unsigned int fd,struct file *filp,struct delegation *deleg); +int fcntl_getdeleg (struct file *filp);static inline bool lock_is_unlock (struct file_lock *fl) {
@@ -271,6 +273,16 @@ static inline int fcntl_getlease(struct file *filp)return F_UNLCK ; } +static inline int fcntl_setdeleg (unsigned int fd,struct file *filp,struct delegation *deleg) +{ +return -EINVAL ; +} + +static inline int fcntl_getdeleg (struct file *filp) +{ +return F_UNLCK ; +} +static inline bool lock_is_unlock (struct file_lock *fl) {return false;
include/uapi/linux/fcntl.h +10 -0
@@ -79,6 +79,16 @@*/ #define RWF_WRITE_LIFE_NOT_SET RWH_WRITE_LIFE_NOT_SET +/* Set/Get delegations */ +#define F_GETDELEG (F_LINUX_SPECIFIC_BASE + 15) +#define F_SETDELEG (F_LINUX_SPECIFIC_BASE + 16) + +/* Argument structure for F_GETDELEG and F_SETDELEG */ +struct delegation { +short d_type;/* F_RDLCK, F_WRLCK, F_UNLCK */ +unsigned int d_flags; +}; +/* * Types of directory notifications that may be requested. */
Signature · 1 line
2.51.0
Christian Brauner
maintainerQuoted 9 lines · Jeff Layton
Behold, another version of directory delegations. This version contains support for recall-only delegations. Support for
CB_NOTIFYwill be forthcoming (once the client-side patches have caught up).This main differences in this version are bugfixes, but the last patch adds a more formal API for userland to request a delegation. That support is optional. We can drop it and the rest of the series should be fine.
Quoted 7 lines
My main interest in making delegations available to userland is to allow testing this support without nfsd. I have an xfstest ready to submit for this if that support looks acceptable. If it is, then I'll also plan to submit an update for fcntl(2).
Christian, Chuck mentioned he was fine with you merging the nfsd bits too, if you're willing to take the whole pile.
Absolutely!
Christian Brauner
maintainerQuoted 9 lines · Jeff Layton
Behold, another version of directory delegations. This version contains support for recall-only delegations. Support for
CB_NOTIFYwill be forthcoming (once the client-side patches have caught up).This main differences in this version are bugfixes, but the last patch adds a more formal API for userland to request a delegation. That support is optional. We can drop it and the rest of the series should be fine.
Quoted 7 lines
My main interest in making delegations available to userland is to allow testing this support without nfsd. I have an xfstest ready to submit for this if that support looks acceptable. If it is, then I'll also plan to submit an update for fcntl(2).
Christian, Chuck mentioned he was fine with you merging the nfsd bits too, if you're willing to take the whole pile.
This all looks good to me btw. The only thing I'm having issues with is:
Base: base-commit d2ced3cadfab04c7e915adf0a73c53fcf1642719 not known, ignoring
Base: attempting to guess base-commit...
Base: tags/v6.18-rc1-23-g2c09630d09c6 (best guess, 21/27 blobs matched)
Base: v6.18-rc1
Magic: Preparing a sparse worktree
Unable to cleanly apply series, see failure log below
---
Applying: filelock: push the S_ISREG check down to ->setlease handlers
Applying: vfs: add try_break_deleg calls for parents to vfs_{link,rename,unlink}
Applying: vfs: allow mkdir to wait for delegation break on parent
Applying: vfs: allow rmdir to wait for delegation break on parent
Patch failed at 0004 vfs: allow rmdir to wait for delegation break on parent
error: invalid object 100644 423dd102b51198ea7c447be2b9a0a5020c950dba for 'fs/nfsd/nfs4recover.c'
error: Repository lacks necessary blobs to fall back on 3-way merge.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"
That commit isn't in -next nor in any of my branches? Can you resend on top of: vfs-6.19.directory.delegations please?
Quoted 71 lines
Thanks!
JeffSigned-off-by Jeff Layton <[email protected]>---
Changes in v3:
- Fix potentialnfsd_filerefcount leaks onGET_DIR_DELEGATIONerror
- Add missing parent dir deleg break invfs_symlink()
- Add F_SETDELEG/F_GETDELEG support tofcntl()
- Link to v2: https://lore.kernel.org/r/[email protected]Changes in v2:
- handle lease conflict resolution inside of nfsd
- drop thelm_may_setleaselock_manageroperation
- just add extra argument tovfs_create()instead of creating wrapper
- don't allocatefsnotify_markfor open directories
- Link to v1: https://lore.kernel.org/r/[email protected]---
Jeff Layton (13):
filelock: push theS_ISREGcheck down to ->setlease handlers
vfs: addtry_break_delegcalls for parents to vfs_{link,rename,unlink}
vfs: allow mkdir to wait for delegation break on parent
vfs: allow rmdir to wait for delegation break on parent
vfs: break parent dir delegations inopen(..., O_CREAT)codepath
vfs: makevfs_createbreak delegations on parent directory
vfs: makevfs_mknodbreak delegations on parent directory
vfs: makevfs_symlinkbreak delegations on parent dir
filelock: lift the ban on directory leases ingeneric_setlease
nfsd: allow filecache to holdS_IFDIRfiles
nfsd: allow DELEGRETURN on directories
nfsd: wire upGET_DIR_DELEGATIONhandling
vfs: expose delegation support to userlanddrivers/base/devtmpfs.c | 6 +- fs/cachefiles/namei.c | 2 +- fs/ecryptfs/inode.c | 10 +-- fs/fcntl.c | 9 +++ fs/fuse/dir.c | 1 + fs/init.c | 6 +- fs/locks.c | 68 +++++++++++++++----- fs/namei.c | 150 +++++++++++++++++++++++++++++++++++---------- fs/nfs/nfs4file.c | 2 + fs/nfsd/filecache.c | 57 ++++++++++++----- fs/nfsd/filecache.h | 2 + fs/nfsd/nfs3proc.c | 2 +- fs/nfsd/nfs4proc.c | 22 ++++++- fs/nfsd/nfs4recover.c | 6 +- fs/nfsd/nfs4state.c | 103 ++++++++++++++++++++++++++++++- fs/nfsd/state.h | 5 ++ fs/nfsd/vfs.c | 16 ++--- fs/nfsd/vfs.h | 2 +- fs/open.c | 2 +- fs/overlayfs/overlayfs.h | 10 +-- fs/smb/client/cifsfs.c | 3 + fs/smb/server/vfs.c | 8 +-- fs/xfs/scrub/orphanage.c | 2 +- include/linux/filelock.h | 12 ++++ include/linux/fs.h | 13 ++-- include/uapi/linux/fcntl.h | 10 +++ net/unix/af_unix.c | 2 +- 27 files changed, 425 insertions(+), 106 deletions(-)---
base-commit:d2ced3cadfab04c7e915adf0a73c53fcf1642719
change-id: 20251013-dir-deleg-ro-d0fe19823b21Best regards,
Signature · 1 line
Jeff Layton <[email protected]>
Jeff Layton
maintainerQuoted 40 lines · Christian Brauner
Quoted 9 lines · Jeff Layton
Behold, another version of directory delegations. This version contains support for recall-only delegations. Support for
CB_NOTIFYwill be forthcoming (once the client-side patches have caught up).This main differences in this version are bugfixes, but the last patch adds a more formal API for userland to request a delegation. That support is optional. We can drop it and the rest of the series should be fine.
Quoted 7 lines
My main interest in making delegations available to userland is to allow testing this support without nfsd. I have an xfstest ready to submit for this if that support looks acceptable. If it is, then I'll also plan to submit an update for fcntl(2).
Christian, Chuck mentioned he was fine with you merging the nfsd bits too, if you're willing to take the whole pile.
This all looks good to me btw. The only thing I'm having issues with is:
Base: base-commit
d2ced3cadfab04c7e915adf0a73c53fcf1642719not known, ignoring
Base: attempting to guess base-commit...
Base: tags/v6.18-rc1-23-g2c09630d09c6 (best guess, 21/27 blobs matched)
Base: v6.18-rc1
Magic: Preparing a sparse worktree
Unable to cleanly apply series, see failure log below
---
Applying: filelock: push theS_ISREGcheck down to ->setlease handlers
Applying: vfs: addtry_break_delegcalls for parents to vfs_{link,rename,unlink}
Applying: vfs: allow mkdir to wait for delegation break on parent
Applying: vfs: allow rmdir to wait for delegation break on parent
Patch failed at 0004 vfs: allow rmdir to wait for delegation break on parent
error: invalid object 100644423dd102b51198ea7c447be2b9a0a5020c950dbafor 'fs/nfsd/nfs4recover.c'
error: Repository lacks necessary blobs to fall back on 3-way merge.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Quoted 3 lines
That commit isn't in -next nor in any of my branches? Can you resend on top of: vfs-6.19.directory.delegations please?
Will do. It's a simple fix. I had based this on top of fs-next, which has Chuck's tree in it too.
Quoted 71 lines
Quoted 71 lines
Thanks!
JeffSigned-off-by Jeff Layton <[email protected]>---
Changes in v3:
- Fix potentialnfsd_filerefcount leaks onGET_DIR_DELEGATIONerror
- Add missing parent dir deleg break invfs_symlink()
- Add F_SETDELEG/F_GETDELEG support tofcntl()
- Link to v2: https://lore.kernel.org/r/[email protected]Changes in v2:
- handle lease conflict resolution inside of nfsd
- drop thelm_may_setleaselock_manageroperation
- just add extra argument tovfs_create()instead of creating wrapper
- don't allocatefsnotify_markfor open directories
- Link to v1: https://lore.kernel.org/r/[email protected]---
Jeff Layton (13):
filelock: push theS_ISREGcheck down to ->setlease handlers
vfs: addtry_break_delegcalls for parents to vfs_{link,rename,unlink}
vfs: allow mkdir to wait for delegation break on parent
vfs: allow rmdir to wait for delegation break on parent
vfs: break parent dir delegations inopen(..., O_CREAT)codepath
vfs: makevfs_createbreak delegations on parent directory
vfs: makevfs_mknodbreak delegations on parent directory
vfs: makevfs_symlinkbreak delegations on parent dir
filelock: lift the ban on directory leases ingeneric_setlease
nfsd: allow filecache to holdS_IFDIRfiles
nfsd: allow DELEGRETURN on directories
nfsd: wire upGET_DIR_DELEGATIONhandling
vfs: expose delegation support to userlanddrivers/base/devtmpfs.c | 6 +- fs/cachefiles/namei.c | 2 +- fs/ecryptfs/inode.c | 10 +-- fs/fcntl.c | 9 +++ fs/fuse/dir.c | 1 + fs/init.c | 6 +- fs/locks.c | 68 +++++++++++++++----- fs/namei.c | 150 +++++++++++++++++++++++++++++++++++---------- fs/nfs/nfs4file.c | 2 + fs/nfsd/filecache.c | 57 ++++++++++++----- fs/nfsd/filecache.h | 2 + fs/nfsd/nfs3proc.c | 2 +- fs/nfsd/nfs4proc.c | 22 ++++++- fs/nfsd/nfs4recover.c | 6 +- fs/nfsd/nfs4state.c | 103 ++++++++++++++++++++++++++++++- fs/nfsd/state.h | 5 ++ fs/nfsd/vfs.c | 16 ++--- fs/nfsd/vfs.h | 2 +- fs/open.c | 2 +- fs/overlayfs/overlayfs.h | 10 +-- fs/smb/client/cifsfs.c | 3 + fs/smb/server/vfs.c | 8 +-- fs/xfs/scrub/orphanage.c | 2 +- include/linux/filelock.h | 12 ++++ include/linux/fs.h | 13 ++-- include/uapi/linux/fcntl.h | 10 +++ net/unix/af_unix.c | 2 +- 27 files changed, 425 insertions(+), 106 deletions(-)---
base-commit:d2ced3cadfab04c7e915adf0a73c53fcf1642719
change-id: 20251013-dir-deleg-ro-d0fe19823b21Best regards,
Signature · 1 line
Jeff Layton <[email protected]>
Signature · 1 line
Jeff Layton <[email protected]>