Skip to contentSkip to conversation

fs/inode.c: fix legacy comment about inode lock

PATCH New yan 1 participant 2 messages Aug 24, 2012 VFS

lore
Share & tools
lore

yan

author
#0 lore raw

PATCH 1/2 fs/inode.c: fix legacy comment about inode lock

inode_lock has been changed to inode_hash_lock

---
 fs/inode.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/inode.c +1 -1
index ac8d904..a9be0a3 100644
@@ -778,7 +778,7 @@ void prune_icache_sb(struct super_block *sb, int nr_to_scan)
 
 static void __wait_on_freeing_inode(struct inode *inode);
 /*
- * Called with the inode lock held.
+ * Called with the inode_hash_lock held.
  */
 static struct inode *find_inode(struct super_block *sb,
 				struct hlist_head *head,
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 2/2 fs/namei.c: only check mountpoint on non-negative dentry

---
 fs/namei.c |   20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
fs/namei.c +14 -6
index dd1ed1b..028f5c8 100644
@@ -3628,11 +3628,15 @@ static int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry,
 		return error;
 
 	dget(new_dentry);
-	if (target)
-		mutex_lock(&target->i_mutex);
 
 	error = -EBUSY;
-	if (d_mountpoint(old_dentry) || d_mountpoint(new_dentry))
+	if (target){
+		mutex_lock(&target->i_mutex);
+		if (d_mountpoint(new_dentry))
+			goto out;
+	}
+
+	if (d_mountpoint(old_dentry))
 		goto out;
 
 	error = -EMLINK;
@@ -3671,11 +3675,15 @@ static int vfs_rename_other(struct inode *old_dir, struct dentry *old_dentry,
 		return error;
 
 	dget(new_dentry);
-	if (target)
-		mutex_lock(&target->i_mutex);
 
 	error = -EBUSY;
-	if (d_mountpoint(old_dentry)||d_mountpoint(new_dentry))
+	if (target){
+		mutex_lock(&target->i_mutex);
+		if (d_mountpoint(new_dentry))
+			goto out;
+	}
+
+	if (d_mountpoint(old_dentry))
 		goto out;
 
 	error = old_dir->i_op->rename(old_dir, old_dentry, new_dir, new_dentry);
Signature · 1 line
1.7.9.5