From: David Howells <dhowells@redhat.com>
To: viro@zeniv.linux.org.uk
Cc: linux-afs@lists.infradead.org, dhowells@redhat.com,
linux-afs@lists.infradead.org, linux-ext4@vger.kernel.org,
linux-ntfs-dev@lists.sourceforge.net,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 4/6] afs: Use RCU inode cache search for callback resolution [ver #2]
Date: Thu, 25 Apr 2019 16:02:19 +0100 [thread overview]
Message-ID: <155620453952.4720.15231543377694604682.stgit@warthog.procyon.org.uk> (raw)
In-Reply-To: <155620449631.4720.8762546550728087460.stgit@warthog.procyon.org.uk>
Search the inode cache under "RCU conditions" when trying to find a vnode
to break the callback on. We don't want to be taking the icache lock if we
can avoid it.
Signed-off-by: David Howells <dhowells@redhat.com>
cc: linux-afs@lists.infradead.org
---
fs/afs/callback.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/fs/afs/callback.c b/fs/afs/callback.c
index 128f2dbe256a..3d0280d4fbf0 100644
--- a/fs/afs/callback.c
+++ b/fs/afs/callback.c
@@ -251,6 +251,7 @@ static void afs_break_one_callback(struct afs_server *server,
struct afs_vnode *vnode;
struct inode *inode;
+ rcu_read_lock();
read_lock(&server->cb_break_lock);
hlist_for_each_entry(vi, &server->cb_volumes, srv_link) {
if (vi->vid < fid->vid)
@@ -284,18 +285,23 @@ static void afs_break_one_callback(struct afs_server *server,
} else {
data.volume = NULL;
data.fid = *fid;
- inode = ilookup5_nowait(cbi->sb, fid->vnode,
- afs_iget5_test, &data);
+
+ /* See if we can find a matching inode - even an I_NEW
+ * inode needs to be marked as it can have its callback
+ * broken before we finish setting up the local inode.
+ */
+ inode = find_inode_rcu(cbi->sb, fid->vnode,
+ afs_iget5_test, &data);
if (inode) {
vnode = AFS_FS_I(inode);
afs_break_callback(vnode);
- iput(inode);
}
}
}
out:
read_unlock(&server->cb_break_lock);
+ rcu_read_unlock();
}
/*
next prev parent reply other threads:[~2019-04-25 15:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-25 15:01 [PATCH 0/6] vfs: Make icache searchable under RCU [ver #2] David Howells
2019-04-25 15:01 ` [PATCH 1/6] vfs, coda: Fix the lack of locking in FID replacement inode rehashing " David Howells
2019-04-25 15:01 ` [PATCH 2/6] vfs: Change inode_hash_lock to a seqlock " David Howells
2019-04-25 15:02 ` [PATCH 3/6] vfs: Allow searching of the icache under RCU conditions " David Howells
2019-04-25 15:19 ` Al Viro
2019-04-25 15:45 ` David Howells
2019-04-25 15:02 ` David Howells [this message]
2019-04-25 15:02 ` [PATCH 5/6] ext4: Search for an inode to update under the RCU lock if we can " David Howells
2019-04-25 15:02 ` [PATCH 6/6] vfs: Delete find_inode_nowait() " David Howells
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=155620453952.4720.15231543377694604682.stgit@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=linux-afs@lists.infradead.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-ntfs-dev@lists.sourceforge.net \
--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;
as well as URLs for NNTP newsgroup(s).