[PATCH] fs/namei: waiting for mutex during name lookups is "killable"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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);

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux