From: Chuck Lever III <chuck.lever@oracle.com>
To: Neil Brown <neilb@suse.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>, Daire Byrne <daire@dneg.com>,
Trond Myklebust <trond.myklebust@hammerspace.com>,
Linux NFS Mailing List <linux-nfs@vger.kernel.org>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 12/12] nfsd: discard fh_locked flag and fh_lock/fh_unlock
Date: Fri, 24 Jun 2022 14:43:39 +0000 [thread overview]
Message-ID: <EC3027E3-04AA-4157-9B7B-3A3D623FDD7B@oracle.com> (raw)
In-Reply-To: <165516230204.21248.4630581281540290265.stgit@noble.brown>
> On Jun 13, 2022, at 7:18 PM, NeilBrown <neilb@suse.de> wrote:
>
> fh_lock() and fh_unlock() are no longer used, so discard them.
> They are the only real users of ->fh_locked, so discard that too.
>
> Signed-off-by: NeilBrown <neilb@suse.de>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
> ---
> fs/nfsd/nfsfh.c | 2 +-
> fs/nfsd/nfsfh.h | 48 ++++--------------------------------------------
> fs/nfsd/vfs.c | 4 ----
> 3 files changed, 5 insertions(+), 49 deletions(-)
>
> diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
> index ae270e4f921f..a3dbe9f34c0e 100644
> --- a/fs/nfsd/nfsfh.c
> +++ b/fs/nfsd/nfsfh.c
> @@ -548,7 +548,7 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry,
> if (ref_fh == fhp)
> fh_put(ref_fh);
>
> - if (fhp->fh_locked || fhp->fh_dentry) {
> + if (fhp->fh_dentry) {
> printk(KERN_ERR "fh_compose: fh %pd2 not initialized!\n",
> dentry);
> }
> diff --git a/fs/nfsd/nfsfh.h b/fs/nfsd/nfsfh.h
> index c5061cdb1016..559912b1d794 100644
> --- a/fs/nfsd/nfsfh.h
> +++ b/fs/nfsd/nfsfh.h
> @@ -81,7 +81,6 @@ typedef struct svc_fh {
> struct dentry * fh_dentry; /* validated dentry */
> struct svc_export * fh_export; /* export pointer */
>
> - bool fh_locked; /* inode locked by us */
> bool fh_want_write; /* remount protection taken */
> bool fh_no_wcc; /* no wcc data needed */
> bool fh_no_atomic_attr;
> @@ -93,7 +92,7 @@ typedef struct svc_fh {
> bool fh_post_saved; /* post-op attrs saved */
> bool fh_pre_saved; /* pre-op attrs saved */
>
> - /* Pre-op attributes saved during fh_lock */
> + /* Pre-op attributes saved when inode exclusively locked */
> __u64 fh_pre_size; /* size before operation */
> struct timespec64 fh_pre_mtime; /* mtime before oper */
> struct timespec64 fh_pre_ctime; /* ctime before oper */
> @@ -103,7 +102,7 @@ typedef struct svc_fh {
> */
> u64 fh_pre_change;
>
> - /* Post-op attributes saved in fh_unlock */
> + /* Post-op attributes saved in fh_fill_post_attrs() */
> struct kstat fh_post_attr; /* full attrs after operation */
> u64 fh_post_change; /* nfsv4 change; see above */
> } svc_fh;
> @@ -223,8 +222,8 @@ void fh_put(struct svc_fh *);
> static __inline__ struct svc_fh *
> fh_copy(struct svc_fh *dst, struct svc_fh *src)
> {
> - WARN_ON(src->fh_dentry || src->fh_locked);
> -
> + WARN_ON(src->fh_dentry);
> +
> *dst = *src;
> return dst;
> }
> @@ -323,43 +322,4 @@ static inline u64 nfsd4_change_attribute(struct kstat *stat,
> extern void fh_fill_pre_attrs(struct svc_fh *fhp, bool atomic);
> extern void fh_fill_post_attrs(struct svc_fh *fhp);
>
> -static inline void
> -fh_lock_nested(struct svc_fh *fhp, unsigned int subclass)
> -{
> - struct dentry *dentry = fhp->fh_dentry;
> - struct inode *inode;
> -
> - BUG_ON(!dentry);
> -
> - if (fhp->fh_locked) {
> - printk(KERN_WARNING "fh_lock: %pd2 already locked!\n",
> - dentry);
> - return;
> - }
> -
> - inode = d_inode(dentry);
> - inode_lock_nested(inode, subclass);
> - fh_fill_pre_attrs(fhp, true);
> - fhp->fh_locked = true;
> -}
> -
> -static inline void
> -fh_lock(struct svc_fh *fhp)
> -{
> - fh_lock_nested(fhp, I_MUTEX_NORMAL);
> -}
> -
> -/*
> - * Unlock a file handle/inode
> - */
> -static inline void
> -fh_unlock(struct svc_fh *fhp)
> -{
> - if (fhp->fh_locked) {
> - fh_fill_post_attrs(fhp);
> - inode_unlock(d_inode(fhp->fh_dentry));
> - fhp->fh_locked = false;
> - }
> -}
> -
> #endif /* _LINUX_NFSD_NFSFH_H */
> diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
> index f2f4868618bb..0e07b19a0289 100644
> --- a/fs/nfsd/vfs.c
> +++ b/fs/nfsd/vfs.c
> @@ -1623,14 +1623,11 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,
> goto out;
> }
>
> - /* cannot use fh_lock as we need deadlock protective ordering
> - * so do it by hand */
> trap = lock_rename_lookup_one(tdentry, fdentry, &ndentry, &odentry,
> tname, tlen, fname, flen, 0, 0, &wq);
> host_err = PTR_ERR(trap);
> if (IS_ERR(trap))
> goto out_nfserr;
> - ffhp->fh_locked = tfhp->fh_locked = true;
> fh_fill_pre_attrs(ffhp, (ndentry->d_flags & DCACHE_PAR_UPDATE) == 0);
> fh_fill_pre_attrs(tfhp, (ndentry->d_flags & DCACHE_PAR_UPDATE) == 0);
>
> @@ -1678,7 +1675,6 @@ nfsd_rename(struct svc_rqst *rqstp, struct svc_fh *ffhp, char *fname, int flen,
> }
> out_unlock:
> unlock_rename_lookup(tdentry, fdentry, ndentry, odentry);
> - ffhp->fh_locked = tfhp->fh_locked = false;
> out_nfserr:
> err = nfserrno(host_err);
> fh_drop_write(ffhp);
>
>
--
Chuck Lever
next prev parent reply other threads:[~2022-06-24 14:49 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-13 23:18 [PATCH RFC 00/12] Allow concurrent directory updates NeilBrown
2022-06-13 23:18 ` [PATCH 03/12] VFS: move want_write checks into lookup_hash_update() NeilBrown
2022-06-13 23:18 ` [PATCH 01/12] VFS: support parallel updates in the one directory NeilBrown
2022-06-13 23:18 ` [PATCH 02/12] VFS: move EEXIST and ENOENT tests into lookup_hash_update() NeilBrown
2022-06-13 23:18 ` [PATCH 05/12] VFS: export done_path_update() NeilBrown
2022-06-13 23:18 ` [PATCH 04/12] VFS: move dput() and mnt_drop_write() into done_path_update() NeilBrown
2022-06-13 23:18 ` [PATCH 06/12] VFS: support concurrent renames NeilBrown
2022-06-14 4:35 ` kernel test robot
2022-06-14 12:37 ` kernel test robot
2022-06-14 13:28 ` kernel test robot
2022-06-26 13:07 ` [VFS] 46a2afd9f6: ltp.rename10.fail kernel test robot
2022-06-13 23:18 ` [PATCH 09/12] nfsd: support concurrent renames NeilBrown
2022-06-24 14:43 ` Chuck Lever III
2022-06-13 23:18 ` [PATCH 11/12] nfsd: use (un)lock_inode instead of fh_(un)lock NeilBrown
2022-06-24 14:43 ` Chuck Lever III
2022-06-13 23:18 ` [PATCH 12/12] nfsd: discard fh_locked flag and fh_lock/fh_unlock NeilBrown
2022-06-24 14:43 ` Chuck Lever III [this message]
2022-06-13 23:18 ` [PATCH 08/12] nfsd: allow parallel creates from nfsd NeilBrown
2022-06-24 14:43 ` Chuck Lever III
2022-06-28 22:35 ` Chuck Lever III
2022-06-28 23:09 ` NeilBrown
2022-07-04 17:17 ` Chuck Lever III
2022-06-13 23:18 ` [PATCH 10/12] nfsd: reduce locking in nfsd_lookup() NeilBrown
2022-06-24 14:43 ` Chuck Lever III
2022-06-13 23:18 ` [PATCH 07/12] NFS: support parallel updates in the one directory NeilBrown
2022-06-15 13:46 ` [PATCH RFC 00/12] Allow concurrent directory updates Daire Byrne
2022-06-16 0:55 ` NeilBrown
2022-06-16 10:48 ` Daire Byrne
2022-06-17 5:49 ` NeilBrown
2022-06-17 15:27 ` Daire Byrne
2022-06-20 10:18 ` Daire Byrne
2022-06-16 13:49 ` Anna Schumaker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=EC3027E3-04AA-4157-9B7B-3A3D623FDD7B@oracle.com \
--to=chuck.lever@oracle.com \
--cc=daire@dneg.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
--cc=trond.myklebust@hammerspace.com \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®