From: Christoph Hellwig <hch@infradead.org>
To: Jeff Layton <jlayton@primarydata.com>
Cc: bfields@fieldses.org, trond.myklebust@primarydata.com,
bhalevy@primarydata.com, linux-nfs@vger.kernel.org
Subject: Re: [PATCH 9/9] NFSd: protect delegation setup with the i_lock
Date: Mon, 2 Jun 2014 01:46:16 -0700 [thread overview]
Message-ID: <20140602084616.GA2910@infradead.org> (raw)
In-Reply-To: <1401455373-18207-10-git-send-email-jlayton@primarydata.com>
On Fri, May 30, 2014 at 09:09:33AM -0400, Jeff Layton wrote:
> From: Trond Myklebust <trond.myklebust@primarydata.com>
>
> state_lock is a heavily contended global lock. We don't want to grab
> that while simultaneously holding the inode->i_lock. Avoid doing that in
> the delegation break callback by ensuring that we add/remove the
> dl_perfile under the inode->i_lock.
The current code never takes the state lock (or recall lock) under
i_lock. Non-trivial use of i_lock in nfsd is only added in this patch.
>
> This however, can cause an ABBA deadlock between the state_lock and the
> i_lock. Work around that by doing the list manipulation in the delegation
> recall from the workqueue context prior to starting the rpc call.
I very much dislike the patch for multiple reasons. For one thing
nfsd currently stays away from i_lock which is a VFS (and sometimes
abused by the fs) lock except for a single case in the file locking code
which really should be factored into common code. I'd rather have
locks in nfsd than starting to use i_lock in nfsd and making auditing
it's use and it's lock hierchies more complex by introducing usage
outside of the VFS.
Second I really don't like pushing the delegation setup into the
callback workqueue. I have a patchset refactoring the callback code
to allow adding more callbacks without lots of copy & paste, and except
for this new addition the code in the workqueue already is almost
perfectly generic for arbitrary callbacks.
Please add a lock in struct nfs4_file to protects it's own members
instead.
next prev parent reply other threads:[~2014-06-02 8:46 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-30 13:09 [PATCH 0/9] nfsd: bugfixes and preliminary patches for client_mutex removal Jeff Layton
2014-05-30 13:09 ` [PATCH 1/9] nfsd: make nfsd4_encode_fattr static Jeff Layton
2014-05-30 13:09 ` [PATCH 2/9] nfsd: fix laundromat next-run-time calculation Jeff Layton
2014-05-30 13:09 ` [PATCH 3/9] nfsd4: use recall_lock for delegation hashing Jeff Layton
2014-05-30 13:09 ` [PATCH 4/9] nfsd: fix setting of NFS4_OO_CONFIRMED in nfsd4_open Jeff Layton
2014-05-30 13:09 ` [PATCH 5/9] nfsd: remove unneeded zeroing of fields in nfsd4_proc_compound Jeff Layton
2014-05-30 13:09 ` [PATCH 6/9] nfsd4: rename recall_lock to state_lock Jeff Layton
2014-05-30 13:09 ` [PATCH 7/9] nfsd4: hash deleg stateid only on successful nfs4_set_delegation Jeff Layton
2014-05-30 13:09 ` [PATCH 8/9] NFSd: Protect addition to the file_hashtbl Jeff Layton
2014-06-05 16:12 ` J. Bruce Fields
2014-06-05 16:18 ` Trond Myklebust
2014-06-05 16:27 ` Jeff Layton
2014-05-30 13:09 ` [PATCH 9/9] NFSd: protect delegation setup with the i_lock Jeff Layton
2014-06-02 8:46 ` Christoph Hellwig [this message]
2014-06-02 14:17 ` Jeff Layton
2014-06-02 18:20 ` Christoph Hellwig
2014-06-02 18:48 ` Jeff Layton
2014-05-30 13:13 ` [PATCH 10/9] nfsd: remove initial assignment of "p" in nfsd4_encode_security_label Jeff Layton
2014-06-04 19:56 ` [PATCH 0/9] nfsd: bugfixes and preliminary patches for client_mutex removal J. Bruce Fields
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=20140602084616.GA2910@infradead.org \
--to=hch@infradead.org \
--cc=bfields@fieldses.org \
--cc=bhalevy@primarydata.com \
--cc=jlayton@primarydata.com \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@primarydata.com \
/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;
as well as URLs for NNTP newsgroup(s).