From: Ryan Mallon <ryan@bluewatersys.com>
To: Matthew Wilcox <matthew@wil.cx>
Cc: viro@zeniv.linux.org.uk, dchinner@redhat.com,
Trond.Myklebust@netapp.com, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org
Subject: Re: [RFC PATCH 1/2] Add unlocked version of igrab.
Date: Mon, 28 Mar 2011 17:39:13 +1300 [thread overview]
Message-ID: <4D9010F1.1040909@bluewatersys.com> (raw)
In-Reply-To: <20110328025423.GN13806@parisc-linux.org>
On 03/28/2011 03:54 PM, Matthew Wilcox wrote:
> On Mon, Mar 28, 2011 at 02:56:00PM +1300, Ryan Mallon wrote:
>> Commit 250df6ed274d767da844a5d9f05720b804240197 "fs: protect
>> inode->i_state with inode->i_lock" changes igrab to acquire inode->i_lock,
>> however some callees, notably nfs_inode_add_request, already hold the lock
>> when calling igrab.
>
> I think a better solution to your problem is to notice that this is
> called in the context of doing a write to an inode. That means we
> must already have a reference count on this inode, so it can't possibly
> be in I_FREEING or I_WILL_FREE. That means we can just call __iget()
> instead ... except that __iget isn't exported to modules.
Ah, okay. Thanks for the hint.
A few other locations that I can see that call igrab with inode->i_lock
held are:
fs/ceph/snap.c::ceph_queue_cap_snap
fs/ceph/addr.c::ceph_set_page_dirty
fs/nfs/nfs4state.c::nfs4_get_open_state
There may be some more cases where the locking is less obvious. I don't
know enough about the filesystem code to say whether each of those can
skip the (I_FREEING | I_WILL_FREE) check, or whether the correct
approach is to modify the filesystems themselves so that they do not
hold i_lock when calling igrab (i.e. rework to use a different outer lock)?
If the correct approach is to use __iget or __igrab then I can prepare a
patch for this. In the case of __iget, should it just be marked
EXPORT_SYMBOL and added to include/linux/fs.h?
~Ryan
--
Bluewater Systems Ltd - ARM Technology Solution Centre
Ryan Mallon 5 Amuri Park, 404 Barbadoes St
ryan@bluewatersys.com PO Box 13 889, Christchurch 8013
http://www.bluewatersys.com New Zealand
Phone: +64 3 3779127 Freecall: Australia 1800 148 751
Fax: +64 3 3779135 USA 1800 261 2934
WARNING: multiple messages have this Message-ID (diff)
From: Ryan Mallon <ryan-7Wk5F4Od5/oYd5yxfr4S2w@public.gmane.org>
To: Matthew Wilcox <matthew-Ztpu424NOJ8@public.gmane.org>
Cc: viro-RmSDqhL/yNMiFSDQTTA3OLVCufUGDwFn@public.gmane.org,
dchinner-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
Trond.Myklebust-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org,
linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [RFC PATCH 1/2] Add unlocked version of igrab.
Date: Mon, 28 Mar 2011 17:39:13 +1300 [thread overview]
Message-ID: <4D9010F1.1040909@bluewatersys.com> (raw)
In-Reply-To: <20110328025423.GN13806-6jwH94ZQLHl74goWV3ctuw@public.gmane.org>
On 03/28/2011 03:54 PM, Matthew Wilcox wrote:
> On Mon, Mar 28, 2011 at 02:56:00PM +1300, Ryan Mallon wrote:
>> Commit 250df6ed274d767da844a5d9f05720b804240197 "fs: protect
>> inode->i_state with inode->i_lock" changes igrab to acquire inode->i_lock,
>> however some callees, notably nfs_inode_add_request, already hold the lock
>> when calling igrab.
>
> I think a better solution to your problem is to notice that this is
> called in the context of doing a write to an inode. That means we
> must already have a reference count on this inode, so it can't possibly
> be in I_FREEING or I_WILL_FREE. That means we can just call __iget()
> instead ... except that __iget isn't exported to modules.
Ah, okay. Thanks for the hint.
A few other locations that I can see that call igrab with inode->i_lock
held are:
fs/ceph/snap.c::ceph_queue_cap_snap
fs/ceph/addr.c::ceph_set_page_dirty
fs/nfs/nfs4state.c::nfs4_get_open_state
There may be some more cases where the locking is less obvious. I don't
know enough about the filesystem code to say whether each of those can
skip the (I_FREEING | I_WILL_FREE) check, or whether the correct
approach is to modify the filesystems themselves so that they do not
hold i_lock when calling igrab (i.e. rework to use a different outer lock)?
If the correct approach is to use __iget or __igrab then I can prepare a
patch for this. In the case of __iget, should it just be marked
EXPORT_SYMBOL and added to include/linux/fs.h?
~Ryan
--
Bluewater Systems Ltd - ARM Technology Solution Centre
Ryan Mallon 5 Amuri Park, 404 Barbadoes St
ryan-7Wk5F4Od5/oYd5yxfr4S2w@public.gmane.org PO Box 13 889, Christchurch 8013
http://www.bluewatersys.com New Zealand
Phone: +64 3 3779127 Freecall: Australia 1800 148 751
Fax: +64 3 3779135 USA 1800 261 2934
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2011-03-28 4:38 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-28 1:55 [RFC PATCH 0/2] Introduce unlocked version of igrab Ryan Mallon
2011-03-28 1:55 ` Ryan Mallon
2011-03-28 1:56 ` [RFC PATCH 1/2] Add " Ryan Mallon
2011-03-28 2:54 ` Matthew Wilcox
2011-03-28 2:54 ` Matthew Wilcox
2011-03-28 4:39 ` Ryan Mallon [this message]
2011-03-28 4:39 ` Ryan Mallon
2011-03-28 5:19 ` [PATCH] fs: don't use igrab() while holding i_lock (was Re: [RFC PATCH 1/2] Add unlocked version of igrab.) Dave Chinner
2011-03-28 5:19 ` Dave Chinner
2011-03-28 1:56 ` [RFC PATCH 2/2] Use __igrab instead of igrab in nfs_inode_add_request Ryan Mallon
2011-03-28 4:43 ` [RFC PATCH 0/2] Introduce unlocked version of igrab Dave Chinner
2011-03-28 4:43 ` Dave Chinner
2011-03-28 4:47 ` Ryan Mallon
2011-03-28 5:03 ` Ryan Mallon
[not found] ` <4D9016B7.1080505-7Wk5F4Od5/oYd5yxfr4S2w@public.gmane.org>
2011-03-28 6:01 ` Dave Chinner
2011-03-28 6:01 ` Dave Chinner
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=4D9010F1.1040909@bluewatersys.com \
--to=ryan@bluewatersys.com \
--cc=Trond.Myklebust@netapp.com \
--cc=dchinner@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=matthew@wil.cx \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.