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

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull vfs fixes from Al Viro:
"A couple of fixes (-stable fodder) + dead code removal after the
overlayfs fix.

I agree that it's better to separate from the fix part to make
backporting easier, but IMO it's not worth delaying said dead code
removal until the next window"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
Don't reset ->total_link_count on nested calls of vfs_path_lookup()
ovl: get rid of the dead code left from broken (and disabled) optimizations
ovl: fix permission checking for setattr

+15 -31
-1
fs/namei.c
··· 1996 1996 nd->last_type = LAST_ROOT; /* if there are only slashes... */ 1997 1997 nd->flags = flags | LOOKUP_JUMPED | LOOKUP_PARENT; 1998 1998 nd->depth = 0; 1999 - nd->total_link_count = 0; 2000 1999 if (flags & LOOKUP_ROOT) { 2001 2000 struct dentry *root = nd->root.dentry; 2002 2001 struct inode *inode = root->d_inode;
+6 -17
fs/overlayfs/copy_up.c
··· 195 195 196 196 static int ovl_copy_up_locked(struct dentry *workdir, struct dentry *upperdir, 197 197 struct dentry *dentry, struct path *lowerpath, 198 - struct kstat *stat, struct iattr *attr, 199 - const char *link) 198 + struct kstat *stat, const char *link) 200 199 { 201 200 struct inode *wdir = workdir->d_inode; 202 201 struct inode *udir = upperdir->d_inode; ··· 239 240 240 241 mutex_lock(&newdentry->d_inode->i_mutex); 241 242 err = ovl_set_attr(newdentry, stat); 242 - if (!err && attr) 243 - err = notify_change(newdentry, attr, NULL); 244 243 mutex_unlock(&newdentry->d_inode->i_mutex); 245 244 if (err) 246 245 goto out_cleanup; ··· 283 286 * that point the file will have already been copied up anyway. 284 287 */ 285 288 int ovl_copy_up_one(struct dentry *parent, struct dentry *dentry, 286 - struct path *lowerpath, struct kstat *stat, 287 - struct iattr *attr) 289 + struct path *lowerpath, struct kstat *stat) 288 290 { 289 291 struct dentry *workdir = ovl_workdir(dentry); 290 292 int err; ··· 341 345 } 342 346 upperdentry = ovl_dentry_upper(dentry); 343 347 if (upperdentry) { 344 - unlock_rename(workdir, upperdir); 348 + /* Raced with another copy-up? Nothing to do, then... */ 345 349 err = 0; 346 - /* Raced with another copy-up? Do the setattr here */ 347 - if (attr) { 348 - mutex_lock(&upperdentry->d_inode->i_mutex); 349 - err = notify_change(upperdentry, attr, NULL); 350 - mutex_unlock(&upperdentry->d_inode->i_mutex); 351 - } 352 - goto out_put_cred; 350 + goto out_unlock; 353 351 } 354 352 355 353 err = ovl_copy_up_locked(workdir, upperdir, dentry, lowerpath, 356 - stat, attr, link); 354 + stat, link); 357 355 if (!err) { 358 356 /* Restore timestamps on parent (best effort) */ 359 357 ovl_set_timestamps(upperdir, &pstat); 360 358 } 361 359 out_unlock: 362 360 unlock_rename(workdir, upperdir); 363 - out_put_cred: 364 361 revert_creds(old_cred); 365 362 put_cred(override_cred); 366 363 ··· 395 406 ovl_path_lower(next, &lowerpath); 396 407 err = vfs_getattr(&lowerpath, &stat); 397 408 if (!err) 398 - err = ovl_copy_up_one(parent, next, &lowerpath, &stat, NULL); 409 + err = ovl_copy_up_one(parent, next, &lowerpath, &stat); 399 410 400 411 dput(parent); 401 412 dput(next);
+8 -11
fs/overlayfs/inode.c
··· 12 12 #include <linux/xattr.h> 13 13 #include "overlayfs.h" 14 14 15 - static int ovl_copy_up_last(struct dentry *dentry, struct iattr *attr, 16 - bool no_data) 15 + static int ovl_copy_up_truncate(struct dentry *dentry) 17 16 { 18 17 int err; 19 18 struct dentry *parent; ··· 29 30 if (err) 30 31 goto out_dput_parent; 31 32 32 - if (no_data) 33 - stat.size = 0; 34 - 35 - err = ovl_copy_up_one(parent, dentry, &lowerpath, &stat, attr); 33 + stat.size = 0; 34 + err = ovl_copy_up_one(parent, dentry, &lowerpath, &stat); 36 35 37 36 out_dput_parent: 38 37 dput(parent); ··· 46 49 if (err) 47 50 goto out; 48 51 49 - upperdentry = ovl_dentry_upper(dentry); 50 - if (upperdentry) { 52 + err = ovl_copy_up(dentry); 53 + if (!err) { 54 + upperdentry = ovl_dentry_upper(dentry); 55 + 51 56 mutex_lock(&upperdentry->d_inode->i_mutex); 52 57 err = notify_change(upperdentry, attr, NULL); 53 58 mutex_unlock(&upperdentry->d_inode->i_mutex); 54 - } else { 55 - err = ovl_copy_up_last(dentry, attr, false); 56 59 } 57 60 ovl_drop_write(dentry); 58 61 out: ··· 350 353 return ERR_PTR(err); 351 354 352 355 if (file_flags & O_TRUNC) 353 - err = ovl_copy_up_last(dentry, NULL, true); 356 + err = ovl_copy_up_truncate(dentry); 354 357 else 355 358 err = ovl_copy_up(dentry); 356 359 ovl_drop_write(dentry);
+1 -2
fs/overlayfs/overlayfs.h
··· 194 194 /* copy_up.c */ 195 195 int ovl_copy_up(struct dentry *dentry); 196 196 int ovl_copy_up_one(struct dentry *parent, struct dentry *dentry, 197 - struct path *lowerpath, struct kstat *stat, 198 - struct iattr *attr); 197 + struct path *lowerpath, struct kstat *stat); 199 198 int ovl_copy_xattr(struct dentry *old, struct dentry *new); 200 199 int ovl_set_attr(struct dentry *upper, struct kstat *stat);