Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'ovl-fixes-5.5-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs

Pull overlayfs fixes from Miklos Szeredi:
"Fix some bugs and documentation"

* tag 'ovl-fixes-5.5-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs:
docs: filesystems: overlayfs: Fix restview warnings
docs: filesystems: overlayfs: Rename overlayfs.txt to .rst
ovl: relax WARN_ON() on rename to self
ovl: fix corner case of non-unique st_dev;st_ino
ovl: don't use a temp buf for encoding real fh
ovl: make sure that real fid is 32bit aligned in memory
ovl: fix lookup failure on multi lower squashfs

+166 -101
+6 -4
Documentation/filesystems/overlayfs.txt Documentation/filesystems/overlayfs.rst
··· 1 + .. SPDX-License-Identifier: GPL-2.0 2 + 1 3 Written by: Neil Brown 2 4 Please see MAINTAINERS file for where to send questions. 3 5 ··· 183 181 worried about backward compatibility with kernels that have the redirect_dir 184 182 feature and follow redirects even if turned off. 185 183 186 - Module options (can also be changed through /sys/module/overlay/parameters/*): 184 + Module options (can also be changed through /sys/module/overlay/parameters/): 187 185 188 186 - "redirect_dir=BOOL": 189 187 See OVERLAY_FS_REDIRECT_DIR kernel config option above. ··· 265 263 266 264 267 265 Metadata only copy up 268 - -------------------- 266 + --------------------- 269 267 270 268 When metadata only copy up feature is enabled, overlayfs will only copy 271 269 up metadata (as opposed to whole file), when a metadata specific operation ··· 288 286 "trusted." xattrs will require CAP_SYS_ADMIN. But it should be possible 289 287 for untrusted layers like from a pen drive. 290 288 291 - Note: redirect_dir={off|nofollow|follow(*)} conflicts with metacopy=on, and 289 + Note: redirect_dir={off|nofollow|follow[*]} conflicts with metacopy=on, and 292 290 results in an error. 293 291 294 - (*) redirect_dir=follow only conflicts with metacopy=on if upperdir=... is 292 + [*] redirect_dir=follow only conflicts with metacopy=on if upperdir=... is 295 293 given. 296 294 297 295 Sharing and copying layers
+1 -1
MAINTAINERS
··· 12394 12394 T: git git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs.git 12395 12395 S: Supported 12396 12396 F: fs/overlayfs/ 12397 - F: Documentation/filesystems/overlayfs.txt 12397 + F: Documentation/filesystems/overlayfs.rst 12398 12398 12399 12399 P54 WIRELESS DRIVER 12400 12400 M: Christian Lamparter <chunkeey@googlemail.com>
+25 -28
fs/overlayfs/copy_up.c
··· 227 227 struct ovl_fh *ovl_encode_real_fh(struct dentry *real, bool is_upper) 228 228 { 229 229 struct ovl_fh *fh; 230 - int fh_type, fh_len, dwords; 231 - void *buf; 230 + int fh_type, dwords; 232 231 int buflen = MAX_HANDLE_SZ; 233 232 uuid_t *uuid = &real->d_sb->s_uuid; 233 + int err; 234 234 235 - buf = kmalloc(buflen, GFP_KERNEL); 236 - if (!buf) 235 + /* Make sure the real fid stays 32bit aligned */ 236 + BUILD_BUG_ON(OVL_FH_FID_OFFSET % 4); 237 + BUILD_BUG_ON(MAX_HANDLE_SZ + OVL_FH_FID_OFFSET > 255); 238 + 239 + fh = kzalloc(buflen + OVL_FH_FID_OFFSET, GFP_KERNEL); 240 + if (!fh) 237 241 return ERR_PTR(-ENOMEM); 238 242 239 243 /* ··· 246 242 * the price or reconnecting the dentry. 247 243 */ 248 244 dwords = buflen >> 2; 249 - fh_type = exportfs_encode_fh(real, buf, &dwords, 0); 245 + fh_type = exportfs_encode_fh(real, (void *)fh->fb.fid, &dwords, 0); 250 246 buflen = (dwords << 2); 251 247 252 - fh = ERR_PTR(-EIO); 248 + err = -EIO; 253 249 if (WARN_ON(fh_type < 0) || 254 250 WARN_ON(buflen > MAX_HANDLE_SZ) || 255 251 WARN_ON(fh_type == FILEID_INVALID)) 256 - goto out; 252 + goto out_err; 257 253 258 - BUILD_BUG_ON(MAX_HANDLE_SZ + offsetof(struct ovl_fh, fid) > 255); 259 - fh_len = offsetof(struct ovl_fh, fid) + buflen; 260 - fh = kmalloc(fh_len, GFP_KERNEL); 261 - if (!fh) { 262 - fh = ERR_PTR(-ENOMEM); 263 - goto out; 264 - } 265 - 266 - fh->version = OVL_FH_VERSION; 267 - fh->magic = OVL_FH_MAGIC; 268 - fh->type = fh_type; 269 - fh->flags = OVL_FH_FLAG_CPU_ENDIAN; 254 + fh->fb.version = OVL_FH_VERSION; 255 + fh->fb.magic = OVL_FH_MAGIC; 256 + fh->fb.type = fh_type; 257 + fh->fb.flags = OVL_FH_FLAG_CPU_ENDIAN; 270 258 /* 271 259 * When we will want to decode an overlay dentry from this handle 272 260 * and all layers are on the same fs, if we get a disconncted real ··· 266 270 * it to upperdentry or to lowerstack is by checking this flag. 267 271 */ 268 272 if (is_upper) 269 - fh->flags |= OVL_FH_FLAG_PATH_UPPER; 270 - fh->len = fh_len; 271 - fh->uuid = *uuid; 272 - memcpy(fh->fid, buf, buflen); 273 + fh->fb.flags |= OVL_FH_FLAG_PATH_UPPER; 274 + fh->fb.len = sizeof(fh->fb) + buflen; 275 + fh->fb.uuid = *uuid; 273 276 274 - out: 275 - kfree(buf); 276 277 return fh; 278 + 279 + out_err: 280 + kfree(fh); 281 + return ERR_PTR(err); 277 282 } 278 283 279 284 int ovl_set_origin(struct dentry *dentry, struct dentry *lower, ··· 297 300 /* 298 301 * Do not fail when upper doesn't support xattrs. 299 302 */ 300 - err = ovl_check_setxattr(dentry, upper, OVL_XATTR_ORIGIN, fh, 301 - fh ? fh->len : 0, 0); 303 + err = ovl_check_setxattr(dentry, upper, OVL_XATTR_ORIGIN, fh->buf, 304 + fh ? fh->fb.len : 0, 0); 302 305 kfree(fh); 303 306 304 307 return err; ··· 314 317 if (IS_ERR(fh)) 315 318 return PTR_ERR(fh); 316 319 317 - err = ovl_do_setxattr(index, OVL_XATTR_UPPER, fh, fh->len, 0); 320 + err = ovl_do_setxattr(index, OVL_XATTR_UPPER, fh->buf, fh->fb.len, 0); 318 321 319 322 kfree(fh); 320 323 return err;
+1 -1
fs/overlayfs/dir.c
··· 1170 1170 if (newdentry == trap) 1171 1171 goto out_dput; 1172 1172 1173 - if (WARN_ON(olddentry->d_inode == newdentry->d_inode)) 1173 + if (olddentry->d_inode == newdentry->d_inode) 1174 1174 goto out_dput; 1175 1175 1176 1176 err = 0;
+49 -31
fs/overlayfs/export.c
··· 211 211 return 1; 212 212 } 213 213 214 - static int ovl_d_to_fh(struct dentry *dentry, char *buf, int buflen) 214 + static int ovl_dentry_to_fid(struct dentry *dentry, u32 *fid, int buflen) 215 215 { 216 216 struct ovl_fh *fh = NULL; 217 217 int err, enc_lower; 218 + int len; 218 219 219 220 /* 220 221 * Check if we should encode a lower or upper file handle and maybe ··· 232 231 return PTR_ERR(fh); 233 232 234 233 err = -EOVERFLOW; 235 - if (fh->len > buflen) 234 + len = OVL_FH_LEN(fh); 235 + if (len > buflen) 236 236 goto fail; 237 237 238 - memcpy(buf, (char *)fh, fh->len); 239 - err = fh->len; 238 + memcpy(fid, fh, len); 239 + err = len; 240 240 241 241 out: 242 242 kfree(fh); ··· 245 243 246 244 fail: 247 245 pr_warn_ratelimited("overlayfs: failed to encode file handle (%pd2, err=%i, buflen=%d, len=%d, type=%d)\n", 248 - dentry, err, buflen, fh ? (int)fh->len : 0, 249 - fh ? fh->type : 0); 246 + dentry, err, buflen, fh ? (int)fh->fb.len : 0, 247 + fh ? fh->fb.type : 0); 250 248 goto out; 251 - } 252 - 253 - static int ovl_dentry_to_fh(struct dentry *dentry, u32 *fid, int *max_len) 254 - { 255 - int res, len = *max_len << 2; 256 - 257 - res = ovl_d_to_fh(dentry, (char *)fid, len); 258 - if (res <= 0) 259 - return FILEID_INVALID; 260 - 261 - len = res; 262 - 263 - /* Round up to dwords */ 264 - *max_len = (len + 3) >> 2; 265 - return OVL_FILEID; 266 249 } 267 250 268 251 static int ovl_encode_fh(struct inode *inode, u32 *fid, int *max_len, 269 252 struct inode *parent) 270 253 { 271 254 struct dentry *dentry; 272 - int type; 255 + int bytes = *max_len << 2; 273 256 274 257 /* TODO: encode connectable file handles */ 275 258 if (parent) ··· 264 277 if (WARN_ON(!dentry)) 265 278 return FILEID_INVALID; 266 279 267 - type = ovl_dentry_to_fh(dentry, fid, max_len); 268 - 280 + bytes = ovl_dentry_to_fid(dentry, fid, bytes); 269 281 dput(dentry); 270 - return type; 282 + if (bytes <= 0) 283 + return FILEID_INVALID; 284 + 285 + *max_len = bytes >> 2; 286 + 287 + return OVL_FILEID_V1; 271 288 } 272 289 273 290 /* ··· 768 777 goto out; 769 778 } 770 779 780 + static struct ovl_fh *ovl_fid_to_fh(struct fid *fid, int buflen, int fh_type) 781 + { 782 + struct ovl_fh *fh; 783 + 784 + /* If on-wire inner fid is aligned - nothing to do */ 785 + if (fh_type == OVL_FILEID_V1) 786 + return (struct ovl_fh *)fid; 787 + 788 + if (fh_type != OVL_FILEID_V0) 789 + return ERR_PTR(-EINVAL); 790 + 791 + fh = kzalloc(buflen, GFP_KERNEL); 792 + if (!fh) 793 + return ERR_PTR(-ENOMEM); 794 + 795 + /* Copy unaligned inner fh into aligned buffer */ 796 + memcpy(&fh->fb, fid, buflen - OVL_FH_WIRE_OFFSET); 797 + return fh; 798 + } 799 + 771 800 static struct dentry *ovl_fh_to_dentry(struct super_block *sb, struct fid *fid, 772 801 int fh_len, int fh_type) 773 802 { 774 803 struct dentry *dentry = NULL; 775 - struct ovl_fh *fh = (struct ovl_fh *) fid; 804 + struct ovl_fh *fh = NULL; 776 805 int len = fh_len << 2; 777 806 unsigned int flags = 0; 778 807 int err; 779 808 780 - err = -EINVAL; 781 - if (fh_type != OVL_FILEID) 809 + fh = ovl_fid_to_fh(fid, len, fh_type); 810 + err = PTR_ERR(fh); 811 + if (IS_ERR(fh)) 782 812 goto out_err; 783 813 784 814 err = ovl_check_fh_len(fh, len); 785 815 if (err) 786 816 goto out_err; 787 817 788 - flags = fh->flags; 818 + flags = fh->fb.flags; 789 819 dentry = (flags & OVL_FH_FLAG_PATH_UPPER) ? 790 820 ovl_upper_fh_to_d(sb, fh) : 791 821 ovl_lower_fh_to_d(sb, fh); ··· 814 802 if (IS_ERR(dentry) && err != -ESTALE) 815 803 goto out_err; 816 804 805 + out: 806 + /* We may have needed to re-align OVL_FILEID_V0 */ 807 + if (!IS_ERR_OR_NULL(fh) && fh != (void *)fid) 808 + kfree(fh); 809 + 817 810 return dentry; 818 811 819 812 out_err: 820 813 pr_warn_ratelimited("overlayfs: failed to decode file handle (len=%d, type=%d, flags=%x, err=%i)\n", 821 - len, fh_type, flags, err); 822 - return ERR_PTR(err); 814 + fh_len, fh_type, flags, err); 815 + dentry = ERR_PTR(err); 816 + goto out; 823 817 } 824 818 825 819 static struct dentry *ovl_fh_to_parent(struct super_block *sb, struct fid *fid,
+7 -1
fs/overlayfs/inode.c
··· 200 200 if (ovl_test_flag(OVL_INDEX, d_inode(dentry)) || 201 201 (!ovl_verify_lower(dentry->d_sb) && 202 202 (is_dir || lowerstat.nlink == 1))) { 203 - stat->ino = lowerstat.ino; 204 203 lower_layer = ovl_layer_lower(dentry); 204 + /* 205 + * Cannot use origin st_dev;st_ino because 206 + * origin inode content may differ from overlay 207 + * inode content. 208 + */ 209 + if (samefs || lower_layer->fsid) 210 + stat->ino = lowerstat.ino; 205 211 } 206 212 207 213 /*
+30 -22
fs/overlayfs/namei.c
··· 84 84 * Return -ENODATA for "origin unknown". 85 85 * Return <0 for an invalid file handle. 86 86 */ 87 - int ovl_check_fh_len(struct ovl_fh *fh, int fh_len) 87 + int ovl_check_fb_len(struct ovl_fb *fb, int fb_len) 88 88 { 89 - if (fh_len < sizeof(struct ovl_fh) || fh_len < fh->len) 89 + if (fb_len < sizeof(struct ovl_fb) || fb_len < fb->len) 90 90 return -EINVAL; 91 91 92 - if (fh->magic != OVL_FH_MAGIC) 92 + if (fb->magic != OVL_FH_MAGIC) 93 93 return -EINVAL; 94 94 95 95 /* Treat larger version and unknown flags as "origin unknown" */ 96 - if (fh->version > OVL_FH_VERSION || fh->flags & ~OVL_FH_FLAG_ALL) 96 + if (fb->version > OVL_FH_VERSION || fb->flags & ~OVL_FH_FLAG_ALL) 97 97 return -ENODATA; 98 98 99 99 /* Treat endianness mismatch as "origin unknown" */ 100 - if (!(fh->flags & OVL_FH_FLAG_ANY_ENDIAN) && 101 - (fh->flags & OVL_FH_FLAG_BIG_ENDIAN) != OVL_FH_FLAG_CPU_ENDIAN) 100 + if (!(fb->flags & OVL_FH_FLAG_ANY_ENDIAN) && 101 + (fb->flags & OVL_FH_FLAG_BIG_ENDIAN) != OVL_FH_FLAG_CPU_ENDIAN) 102 102 return -ENODATA; 103 103 104 104 return 0; ··· 119 119 if (res == 0) 120 120 return NULL; 121 121 122 - fh = kzalloc(res, GFP_KERNEL); 122 + fh = kzalloc(res + OVL_FH_WIRE_OFFSET, GFP_KERNEL); 123 123 if (!fh) 124 124 return ERR_PTR(-ENOMEM); 125 125 126 - res = vfs_getxattr(dentry, name, fh, res); 126 + res = vfs_getxattr(dentry, name, fh->buf, res); 127 127 if (res < 0) 128 128 goto fail; 129 129 130 - err = ovl_check_fh_len(fh, res); 130 + err = ovl_check_fb_len(&fh->fb, res); 131 131 if (err < 0) { 132 132 if (err == -ENODATA) 133 133 goto out; ··· 158 158 * Make sure that the stored uuid matches the uuid of the lower 159 159 * layer where file handle will be decoded. 160 160 */ 161 - if (!uuid_equal(&fh->uuid, &mnt->mnt_sb->s_uuid)) 161 + if (!uuid_equal(&fh->fb.uuid, &mnt->mnt_sb->s_uuid)) 162 162 return NULL; 163 163 164 - bytes = (fh->len - offsetof(struct ovl_fh, fid)); 165 - real = exportfs_decode_fh(mnt, (struct fid *)fh->fid, 166 - bytes >> 2, (int)fh->type, 164 + bytes = (fh->fb.len - offsetof(struct ovl_fb, fid)); 165 + real = exportfs_decode_fh(mnt, (struct fid *)fh->fb.fid, 166 + bytes >> 2, (int)fh->fb.type, 167 167 connected ? ovl_acceptable : NULL, mnt); 168 168 if (IS_ERR(real)) { 169 169 /* ··· 173 173 * index entries correctly. 174 174 */ 175 175 if (real == ERR_PTR(-ESTALE) && 176 - !(fh->flags & OVL_FH_FLAG_PATH_UPPER)) 176 + !(fh->fb.flags & OVL_FH_FLAG_PATH_UPPER)) 177 177 real = NULL; 178 178 return real; 179 179 } ··· 323 323 int i; 324 324 325 325 for (i = 0; i < ofs->numlower; i++) { 326 + /* 327 + * If lower fs uuid is not unique among lower fs we cannot match 328 + * fh->uuid to layer. 329 + */ 330 + if (ofs->lower_layers[i].fsid && 331 + ofs->lower_layers[i].fs->bad_uuid) 332 + continue; 333 + 326 334 origin = ovl_decode_real_fh(fh, ofs->lower_layers[i].mnt, 327 335 connected); 328 336 if (origin) ··· 408 400 if (IS_ERR(ofh)) 409 401 return PTR_ERR(ofh); 410 402 411 - if (fh->len != ofh->len || memcmp(fh, ofh, fh->len)) 403 + if (fh->fb.len != ofh->fb.len || memcmp(&fh->fb, &ofh->fb, fh->fb.len)) 412 404 err = -ESTALE; 413 405 414 406 kfree(ofh); ··· 439 431 440 432 err = ovl_verify_fh(dentry, name, fh); 441 433 if (set && err == -ENODATA) 442 - err = ovl_do_setxattr(dentry, name, fh, fh->len, 0); 434 + err = ovl_do_setxattr(dentry, name, fh->buf, fh->fb.len, 0); 443 435 if (err) 444 436 goto fail; 445 437 ··· 513 505 goto fail; 514 506 515 507 err = -EINVAL; 516 - if (index->d_name.len < sizeof(struct ovl_fh)*2) 508 + if (index->d_name.len < sizeof(struct ovl_fb)*2) 517 509 goto fail; 518 510 519 511 err = -ENOMEM; 520 512 len = index->d_name.len / 2; 521 - fh = kzalloc(len, GFP_KERNEL); 513 + fh = kzalloc(len + OVL_FH_WIRE_OFFSET, GFP_KERNEL); 522 514 if (!fh) 523 515 goto fail; 524 516 525 517 err = -EINVAL; 526 - if (hex2bin((u8 *)fh, index->d_name.name, len)) 518 + if (hex2bin(fh->buf, index->d_name.name, len)) 527 519 goto fail; 528 520 529 - err = ovl_check_fh_len(fh, len); 521 + err = ovl_check_fb_len(&fh->fb, len); 530 522 if (err) 531 523 goto fail; 532 524 ··· 605 597 { 606 598 char *n, *s; 607 599 608 - n = kcalloc(fh->len, 2, GFP_KERNEL); 600 + n = kcalloc(fh->fb.len, 2, GFP_KERNEL); 609 601 if (!n) 610 602 return -ENOMEM; 611 603 612 - s = bin2hex(n, fh, fh->len); 604 + s = bin2hex(n, fh->buf, fh->fb.len); 613 605 *name = (struct qstr) QSTR_INIT(n, s - n); 614 606 615 607 return 0;
+28 -6
fs/overlayfs/overlayfs.h
··· 71 71 #error Endianness not defined 72 72 #endif 73 73 74 - /* The type returned by overlay exportfs ops when encoding an ovl_fh handle */ 75 - #define OVL_FILEID 0xfb 74 + /* The type used to be returned by overlay exportfs for misaligned fid */ 75 + #define OVL_FILEID_V0 0xfb 76 + /* The type returned by overlay exportfs for 32bit aligned fid */ 77 + #define OVL_FILEID_V1 0xf8 76 78 77 - /* On-disk and in-memeory format for redirect by file handle */ 78 - struct ovl_fh { 79 + /* On-disk format for "origin" file handle */ 80 + struct ovl_fb { 79 81 u8 version; /* 0 */ 80 82 u8 magic; /* 0xfb */ 81 83 u8 len; /* size of this header + size of fid */ 82 84 u8 flags; /* OVL_FH_FLAG_* */ 83 85 u8 type; /* fid_type of fid */ 84 86 uuid_t uuid; /* uuid of filesystem */ 85 - u8 fid[0]; /* file identifier */ 87 + u32 fid[0]; /* file identifier should be 32bit aligned in-memory */ 86 88 } __packed; 89 + 90 + /* In-memory and on-wire format for overlay file handle */ 91 + struct ovl_fh { 92 + u8 padding[3]; /* make sure fb.fid is 32bit aligned */ 93 + union { 94 + struct ovl_fb fb; 95 + u8 buf[0]; 96 + }; 97 + } __packed; 98 + 99 + #define OVL_FH_WIRE_OFFSET offsetof(struct ovl_fh, fb) 100 + #define OVL_FH_LEN(fh) (OVL_FH_WIRE_OFFSET + (fh)->fb.len) 101 + #define OVL_FH_FID_OFFSET (OVL_FH_WIRE_OFFSET + \ 102 + offsetof(struct ovl_fb, fid)) 87 103 88 104 static inline int ovl_do_rmdir(struct inode *dir, struct dentry *dentry) 89 105 { ··· 318 302 319 303 320 304 /* namei.c */ 321 - int ovl_check_fh_len(struct ovl_fh *fh, int fh_len); 305 + int ovl_check_fb_len(struct ovl_fb *fb, int fb_len); 306 + 307 + static inline int ovl_check_fh_len(struct ovl_fh *fh, int fh_len) 308 + { 309 + return ovl_check_fb_len(&fh->fb, fh_len - OVL_FH_WIRE_OFFSET); 310 + } 311 + 322 312 struct dentry *ovl_decode_real_fh(struct ovl_fh *fh, struct vfsmount *mnt, 323 313 bool connected); 324 314 int ovl_check_origin_fh(struct ovl_fs *ofs, struct ovl_fh *fh, bool connected,
+2
fs/overlayfs/ovl_entry.h
··· 22 22 struct ovl_sb { 23 23 struct super_block *sb; 24 24 dev_t pseudo_dev; 25 + /* Unusable (conflicting) uuid */ 26 + bool bad_uuid; 25 27 }; 26 28 27 29 struct ovl_layer {
+17 -7
fs/overlayfs/super.c
··· 1255 1255 { 1256 1256 unsigned int i; 1257 1257 1258 - if (!ofs->config.nfs_export && !(ofs->config.index && ofs->upper_mnt)) 1258 + if (!ofs->config.nfs_export && !ofs->upper_mnt) 1259 1259 return true; 1260 1260 1261 1261 for (i = 0; i < ofs->numlowerfs; i++) { ··· 1263 1263 * We use uuid to associate an overlay lower file handle with a 1264 1264 * lower layer, so we can accept lower fs with null uuid as long 1265 1265 * as all lower layers with null uuid are on the same fs. 1266 + * if we detect multiple lower fs with the same uuid, we 1267 + * disable lower file handle decoding on all of them. 1266 1268 */ 1267 - if (uuid_equal(&ofs->lower_fs[i].sb->s_uuid, uuid)) 1269 + if (uuid_equal(&ofs->lower_fs[i].sb->s_uuid, uuid)) { 1270 + ofs->lower_fs[i].bad_uuid = true; 1268 1271 return false; 1272 + } 1269 1273 } 1270 1274 return true; 1271 1275 } ··· 1281 1277 unsigned int i; 1282 1278 dev_t dev; 1283 1279 int err; 1280 + bool bad_uuid = false; 1284 1281 1285 1282 /* fsid 0 is reserved for upper fs even with non upper overlay */ 1286 1283 if (ofs->upper_mnt && ofs->upper_mnt->mnt_sb == sb) ··· 1293 1288 } 1294 1289 1295 1290 if (!ovl_lower_uuid_ok(ofs, &sb->s_uuid)) { 1296 - ofs->config.index = false; 1297 - ofs->config.nfs_export = false; 1298 - pr_warn("overlayfs: %s uuid detected in lower fs '%pd2', falling back to index=off,nfs_export=off.\n", 1299 - uuid_is_null(&sb->s_uuid) ? "null" : "conflicting", 1300 - path->dentry); 1291 + bad_uuid = true; 1292 + if (ofs->config.index || ofs->config.nfs_export) { 1293 + ofs->config.index = false; 1294 + ofs->config.nfs_export = false; 1295 + pr_warn("overlayfs: %s uuid detected in lower fs '%pd2', falling back to index=off,nfs_export=off.\n", 1296 + uuid_is_null(&sb->s_uuid) ? "null" : 1297 + "conflicting", 1298 + path->dentry); 1299 + } 1301 1300 } 1302 1301 1303 1302 err = get_anon_bdev(&dev); ··· 1312 1303 1313 1304 ofs->lower_fs[ofs->numlowerfs].sb = sb; 1314 1305 ofs->lower_fs[ofs->numlowerfs].pseudo_dev = dev; 1306 + ofs->lower_fs[ofs->numlowerfs].bad_uuid = bad_uuid; 1315 1307 ofs->numlowerfs++; 1316 1308 1317 1309 return ofs->numlowerfs;