From: Max Kellermann <mk@cm4all.com>
To: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] fs/namei: waiting for mutex during name lookups is "killable"
Date: Mon, 28 Nov 2011 12:39:18 +0100 [thread overview]
Message-ID: <20111128113918.23050.25938.stgit@rabbit.intern.cm-ag> (raw)
Use mutex_lock_killable() instead of mutex_lock() during name lookups,
to allow killing the process while it's waiting.
Signed-off-by: Max Kellermann <mk@cm4all.com>
---
fs/namei.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/fs/namei.c b/fs/namei.c
index 3d15072..08a3163 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1169,7 +1169,10 @@ retry:
struct inode *dir = parent->d_inode;
BUG_ON(nd->inode != dir);
- mutex_lock(&dir->i_mutex);
+ err = mutex_lock_killable(&dir->i_mutex);
+ if (unlikely(err))
+ return err;
+
dentry = d_lookup(parent, name);
if (likely(!dentry)) {
dentry = d_alloc_and_lookup(parent, name, nd);
@@ -2166,7 +2169,9 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
if (nd->last.name[nd->last.len])
goto exit;
- mutex_lock(&dir->d_inode->i_mutex);
+ error = mutex_lock_killable(&dir->d_inode->i_mutex);
+ if (unlikely(error))
+ goto exit;
dentry = lookup_hash(nd);
error = PTR_ERR(dentry);
next reply other threads:[~2011-11-28 11:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-28 11:39 Max Kellermann [this message]
2011-11-28 12:19 ` [PATCH] fs/namei: waiting for mutex during name lookups is "killable" Matthew Wilcox
2011-11-28 12:30 ` Max Kellermann
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=20111128113918.23050.25938.stgit@rabbit.intern.cm-ag \
--to=mk@cm4all.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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).