Commit c7aee394 authored by Amir Goldstein's avatar Amir Goldstein Committed by Greg Kroah-Hartman

ovl: take mnt_want_write() for removing impure xattr

commit a5a927a7 upstream.

The optimization in ovl_cache_get_impure() that tries to remove an
unneeded "impure" xattr needs to take mnt_want_write() on upper fs.

Fixes: 4edb83bb ("ovl: constant d_ino for non-merge dirs")
Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e822be75
...@@ -575,8 +575,15 @@ static struct ovl_dir_cache *ovl_cache_get_impure(struct path *path) ...@@ -575,8 +575,15 @@ static struct ovl_dir_cache *ovl_cache_get_impure(struct path *path)
return ERR_PTR(res); return ERR_PTR(res);
} }
if (list_empty(&cache->entries)) { if (list_empty(&cache->entries)) {
/* Good oportunity to get rid of an unnecessary "impure" flag */ /*
ovl_do_removexattr(ovl_dentry_upper(dentry), OVL_XATTR_IMPURE); * A good opportunity to get rid of an unneeded "impure" flag.
* Removing the "impure" xattr is best effort.
*/
if (!ovl_want_write(dentry)) {
ovl_do_removexattr(ovl_dentry_upper(dentry),
OVL_XATTR_IMPURE);
ovl_drop_write(dentry);
}
ovl_clear_flag(OVL_IMPURE, d_inode(dentry)); ovl_clear_flag(OVL_IMPURE, d_inode(dentry));
kfree(cache); kfree(cache);
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment