overlayfs update for 6.0

-----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQSQHSd0lITzzeNWNm3h3BK/laaZPAUCYvDeCAAKCRDh3BK/laaZ
 PGjCAP9TVuId3X7Akroc9W+qswPzwlW3fwtE6+9F6ABeNJNPZAEAgU2bp95vqZRh
 OWP+ptnskceBcX/cRkfxkmgtiNE21wk=
 =sucY
 -----END PGP SIGNATURE-----

Merge tag 'ovl-update-6.0' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs

Pull overlayfs update from Miklos Szeredi:
 "Just a small update"

* tag 'ovl-update-6.0' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs:
  ovl: fix spelling mistakes
  ovl: drop WARN_ON() dentry is NULL in ovl_encode_fh()
  ovl: improve ovl_get_acl() if POSIX ACL support is off
  ovl: fix some kernel-doc comments
  ovl: warn if trusted xattr creation fails
This commit is contained in:
Linus Torvalds 2022-08-08 11:03:11 -07:00
commit 65512eb0e9
5 changed files with 21 additions and 8 deletions

View File

@ -259,7 +259,7 @@ static int ovl_encode_fh(struct inode *inode, u32 *fid, int *max_len,
return FILEID_INVALID; return FILEID_INVALID;
dentry = d_find_any_alias(inode); dentry = d_find_any_alias(inode);
if (WARN_ON(!dentry)) if (!dentry)
return FILEID_INVALID; return FILEID_INVALID;
bytes = ovl_dentry_to_fid(ofs, dentry, fid, buflen); bytes = ovl_dentry_to_fid(ofs, dentry, fid, buflen);

View File

@ -454,6 +454,7 @@ ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size)
return res; return res;
} }
#ifdef CONFIG_FS_POSIX_ACL
/* /*
* Apply the idmapping of the layer to POSIX ACLs. The caller must pass a clone * Apply the idmapping of the layer to POSIX ACLs. The caller must pass a clone
* of the POSIX ACLs retrieved from the lower layer to this function to not * of the POSIX ACLs retrieved from the lower layer to this function to not
@ -497,7 +498,7 @@ struct posix_acl *ovl_get_acl(struct inode *inode, int type, bool rcu)
struct posix_acl *acl, *clone; struct posix_acl *acl, *clone;
struct path realpath; struct path realpath;
if (!IS_ENABLED(CONFIG_FS_POSIX_ACL) || !IS_POSIXACL(realinode)) if (!IS_POSIXACL(realinode))
return NULL; return NULL;
/* Careful in RCU walk mode */ /* Careful in RCU walk mode */
@ -543,6 +544,7 @@ struct posix_acl *ovl_get_acl(struct inode *inode, int type, bool rcu)
posix_acl_release(acl); posix_acl_release(acl);
return clone; return clone;
} }
#endif
int ovl_update_time(struct inode *inode, struct timespec64 *ts, int flags) int ovl_update_time(struct inode *inode, struct timespec64 *ts, int flags)
{ {

View File

@ -42,7 +42,7 @@ static int ovl_check_redirect(struct path *path, struct ovl_lookup_data *d,
* One of the ancestor path elements in an absolute path * One of the ancestor path elements in an absolute path
* lookup in ovl_lookup_layer() could have been opaque and * lookup in ovl_lookup_layer() could have been opaque and
* that will stop further lookup in lower layers (d->stop=true) * that will stop further lookup in lower layers (d->stop=true)
* But we have found an absolute redirect in decendant path * But we have found an absolute redirect in descendant path
* element and that should force continue lookup in lower * element and that should force continue lookup in lower
* layers (reset d->stop). * layers (reset d->stop).
*/ */
@ -648,7 +648,7 @@ static int ovl_get_index_name_fh(struct ovl_fh *fh, struct qstr *name)
* If the index dentry for a copy up origin inode is positive, but points * If the index dentry for a copy up origin inode is positive, but points
* to an inode different than the upper inode, then either the upper inode * to an inode different than the upper inode, then either the upper inode
* has been copied up and not indexed or it was indexed, but since then * has been copied up and not indexed or it was indexed, but since then
* index dir was cleared. Either way, that index cannot be used to indentify * index dir was cleared. Either way, that index cannot be used to identify
* the overlay inode. * the overlay inode.
*/ */
int ovl_get_index_name(struct ovl_fs *ofs, struct dentry *origin, int ovl_get_index_name(struct ovl_fs *ofs, struct dentry *origin,

View File

@ -590,7 +590,13 @@ int ovl_xattr_set(struct dentry *dentry, struct inode *inode, const char *name,
int ovl_xattr_get(struct dentry *dentry, struct inode *inode, const char *name, int ovl_xattr_get(struct dentry *dentry, struct inode *inode, const char *name,
void *value, size_t size); void *value, size_t size);
ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size); ssize_t ovl_listxattr(struct dentry *dentry, char *list, size_t size);
#ifdef CONFIG_FS_POSIX_ACL
struct posix_acl *ovl_get_acl(struct inode *inode, int type, bool rcu); struct posix_acl *ovl_get_acl(struct inode *inode, int type, bool rcu);
#else
#define ovl_get_acl NULL
#endif
int ovl_update_time(struct inode *inode, struct timespec64 *ts, int flags); int ovl_update_time(struct inode *inode, struct timespec64 *ts, int flags);
bool ovl_is_private_xattr(struct super_block *sb, const char *name); bool ovl_is_private_xattr(struct super_block *sb, const char *name);

View File

@ -301,7 +301,7 @@ static int ovl_sync_fs(struct super_block *sb, int wait)
/** /**
* ovl_statfs * ovl_statfs
* @sb: The overlayfs super block * @dentry: The dentry to query
* @buf: The struct kstatfs to fill in with stats * @buf: The struct kstatfs to fill in with stats
* *
* Get the filesystem statistics. As writes always target the upper layer * Get the filesystem statistics. As writes always target the upper layer
@ -349,6 +349,8 @@ static inline int ovl_xino_def(void)
/** /**
* ovl_show_options * ovl_show_options
* @m: the seq_file handle
* @dentry: The dentry to query
* *
* Prints the mount options for a given superblock. * Prints the mount options for a given superblock.
* Returns zero; does not fail. * Returns zero; does not fail.
@ -1412,11 +1414,12 @@ static int ovl_make_workdir(struct super_block *sb, struct ovl_fs *ofs,
*/ */
err = ovl_setxattr(ofs, ofs->workdir, OVL_XATTR_OPAQUE, "0", 1); err = ovl_setxattr(ofs, ofs->workdir, OVL_XATTR_OPAQUE, "0", 1);
if (err) { if (err) {
pr_warn("failed to set xattr on upper\n");
ofs->noxattr = true; ofs->noxattr = true;
if (ofs->config.index || ofs->config.metacopy) { if (ofs->config.index || ofs->config.metacopy) {
ofs->config.index = false; ofs->config.index = false;
ofs->config.metacopy = false; ofs->config.metacopy = false;
pr_warn("upper fs does not support xattr, falling back to index=off,metacopy=off.\n"); pr_warn("...falling back to index=off,metacopy=off.\n");
} }
/* /*
* xattr support is required for persistent st_ino. * xattr support is required for persistent st_ino.
@ -1424,8 +1427,10 @@ static int ovl_make_workdir(struct super_block *sb, struct ovl_fs *ofs,
*/ */
if (ofs->config.xino == OVL_XINO_AUTO) { if (ofs->config.xino == OVL_XINO_AUTO) {
ofs->config.xino = OVL_XINO_OFF; ofs->config.xino = OVL_XINO_OFF;
pr_warn("upper fs does not support xattr, falling back to xino=off.\n"); pr_warn("...falling back to xino=off.\n");
} }
if (err == -EPERM && !ofs->config.userxattr)
pr_info("try mounting with 'userxattr' option\n");
err = 0; err = 0;
} else { } else {
ovl_removexattr(ofs, ofs->workdir, OVL_XATTR_OPAQUE); ovl_removexattr(ofs, ofs->workdir, OVL_XATTR_OPAQUE);
@ -2032,7 +2037,7 @@ static int ovl_fill_super(struct super_block *sb, void *data, int silent)
sb->s_stack_depth = 0; sb->s_stack_depth = 0;
sb->s_maxbytes = MAX_LFS_FILESIZE; sb->s_maxbytes = MAX_LFS_FILESIZE;
atomic_long_set(&ofs->last_ino, 1); atomic_long_set(&ofs->last_ino, 1);
/* Assume underlaying fs uses 32bit inodes unless proven otherwise */ /* Assume underlying fs uses 32bit inodes unless proven otherwise */
if (ofs->config.xino != OVL_XINO_OFF) { if (ofs->config.xino != OVL_XINO_OFF) {
ofs->xino_mode = BITS_PER_LONG - 32; ofs->xino_mode = BITS_PER_LONG - 32;
if (!ofs->xino_mode) { if (!ofs->xino_mode) {