Skip to contentSkip to conversation

overlay: remove not necessary lock check.

PATCH Applied youngjun 2 participants 2 messages Jun 7, 2020 – Jun 8, 2020 Overlay filesystem

lore
Share & tools
lore

youngjun

author
#0 lore raw

PATCH 1/1 overlay: remove not necessary lock check.

dir is always locked until "out_unlock" label.
So lock check is not needed.

---
 fs/overlayfs/super.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
fs/overlayfs/super.c +1 -5
index 732ad5495c92..43257c18fe26 100644
@@ -615,10 +615,8 @@ static struct dentry *ovl_workdir_create(struct ovl_fs *ofs,
 	struct dentry *work;
 	int err;
 	bool retried = false;
-	bool locked = false;
 
 	inode_lock_nested(dir, I_MUTEX_PARENT);
-	locked = true;
 
 retry:
 	work = lookup_one_len(name, ofs->workbasedir, strlen(name));
@@ -680,9 +678,7 @@ static struct dentry *ovl_workdir_create(struct ovl_fs *ofs,
 		goto out_err;
 	}
 out_unlock:
-	if (locked)
-		inode_unlock(dir);
-
+	inode_unlock(dir);
 	return work;
 
 out_dput:
Signature · 1 line
2.17.1
maintainer Applied
#1 lore raw
Quoted 3 lines · youngjun

dir is always locked until "out_unlock" label.
So lock check is not needed.

Thanks, applied.

Miklos