diff options
author | Amir Goldstein <amir73il@gmail.com> | 2018-10-18 17:37:13 +0200 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2018-10-26 23:34:40 +0200 |
commit | 0e32992f7faccd50d1b00032de83e87a35fed247 (patch) | |
tree | 3143c2007ff1061bff7517016592d71b46c81911 /fs/overlayfs/util.c | |
parent | ovl: relax requirement for non null uuid of lower fs (diff) | |
download | linux-0e32992f7faccd50d1b00032de83e87a35fed247.tar.xz linux-0e32992f7faccd50d1b00032de83e87a35fed247.zip |
ovl: remove the 'locked' argument of ovl_nlink_{start,end}
It just makes the interface strange without adding any significant value.
The only case where locked is false and return value is 0 is in
ovl_rename() when new is negative, so handle that case explicitly in
ovl_rename().
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/overlayfs/util.c')
-rw-r--r-- | fs/overlayfs/util.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c index 8cd37baf5d0a..d3a786006729 100644 --- a/fs/overlayfs/util.c +++ b/fs/overlayfs/util.c @@ -738,14 +738,14 @@ fail: * Operations that change overlay inode and upper inode nlink need to be * synchronized with copy up for persistent nlink accounting. */ -int ovl_nlink_start(struct dentry *dentry, bool *locked) +int ovl_nlink_start(struct dentry *dentry) { struct ovl_inode *oi = OVL_I(d_inode(dentry)); const struct cred *old_cred; int err; - if (!d_inode(dentry)) - return 0; + if (WARN_ON(!d_inode(dentry))) + return -ENOENT; /* * With inodes index is enabled, we store the union overlay nlink @@ -787,26 +787,22 @@ int ovl_nlink_start(struct dentry *dentry, bool *locked) out: if (err) mutex_unlock(&oi->lock); - else - *locked = true; return err; } -void ovl_nlink_end(struct dentry *dentry, bool locked) +void ovl_nlink_end(struct dentry *dentry) { - if (locked) { - if (ovl_test_flag(OVL_INDEX, d_inode(dentry)) && - d_inode(dentry)->i_nlink == 0) { - const struct cred *old_cred; - - old_cred = ovl_override_creds(dentry->d_sb); - ovl_cleanup_index(dentry); - revert_creds(old_cred); - } + if (ovl_test_flag(OVL_INDEX, d_inode(dentry)) && + d_inode(dentry)->i_nlink == 0) { + const struct cred *old_cred; - mutex_unlock(&OVL_I(d_inode(dentry))->lock); + old_cred = ovl_override_creds(dentry->d_sb); + ovl_cleanup_index(dentry); + revert_creds(old_cred); } + + mutex_unlock(&OVL_I(d_inode(dentry))->lock); } int ovl_lock_rename_workdir(struct dentry *workdir, struct dentry *upperdir) |