readdir.c (22f289ce1f8b10556617157819a48cf13370f06f) | readdir.c (ba9ea771ec8a9da4e3aa5cb8c8549fc3b15b2641) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * 4 * Copyright (C) 2011 Novell Inc. 5 */ 6 7#include <linux/fs.h> 8#include <linux/slab.h> --- 250 unchanged lines hidden (view full) --- 259 260 rdd->count++; 261 if (!rdd->is_lowest) 262 return ovl_cache_entry_add_rb(rdd, name, namelen, ino, d_type); 263 else 264 return ovl_fill_lowest(rdd, name, namelen, offset, ino, d_type); 265} 266 | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * 4 * Copyright (C) 2011 Novell Inc. 5 */ 6 7#include <linux/fs.h> 8#include <linux/slab.h> --- 250 unchanged lines hidden (view full) --- 259 260 rdd->count++; 261 if (!rdd->is_lowest) 262 return ovl_cache_entry_add_rb(rdd, name, namelen, ino, d_type); 263 else 264 return ovl_fill_lowest(rdd, name, namelen, offset, ino, d_type); 265} 266 |
267static int ovl_check_whiteouts(struct dentry *dir, struct ovl_readdir_data *rdd) | 267static int ovl_check_whiteouts(struct path *path, struct ovl_readdir_data *rdd) |
268{ 269 int err; 270 struct ovl_cache_entry *p; | 268{ 269 int err; 270 struct ovl_cache_entry *p; |
271 struct dentry *dentry; | 271 struct dentry *dentry, *dir = path->dentry; |
272 const struct cred *old_cred; 273 274 old_cred = ovl_override_creds(rdd->dentry->d_sb); 275 276 err = down_write_killable(&dir->d_inode->i_rwsem); 277 if (!err) { 278 while (rdd->first_maybe_whiteout) { 279 p = rdd->first_maybe_whiteout; 280 rdd->first_maybe_whiteout = p->next_maybe_whiteout; | 272 const struct cred *old_cred; 273 274 old_cred = ovl_override_creds(rdd->dentry->d_sb); 275 276 err = down_write_killable(&dir->d_inode->i_rwsem); 277 if (!err) { 278 while (rdd->first_maybe_whiteout) { 279 p = rdd->first_maybe_whiteout; 280 rdd->first_maybe_whiteout = p->next_maybe_whiteout; |
281 dentry = lookup_one_len(p->name, dir, p->len); | 281 dentry = lookup_one(mnt_user_ns(path->mnt), p->name, dir, p->len); |
282 if (!IS_ERR(dentry)) { 283 p->is_whiteout = ovl_is_whiteout(dentry); 284 dput(dentry); 285 } 286 } 287 inode_unlock(dir->d_inode); 288 } 289 revert_creds(old_cred); --- 17 unchanged lines hidden (view full) --- 307 rdd->count = 0; 308 rdd->err = 0; 309 err = iterate_dir(realfile, &rdd->ctx); 310 if (err >= 0) 311 err = rdd->err; 312 } while (!err && rdd->count); 313 314 if (!err && rdd->first_maybe_whiteout && rdd->dentry) | 282 if (!IS_ERR(dentry)) { 283 p->is_whiteout = ovl_is_whiteout(dentry); 284 dput(dentry); 285 } 286 } 287 inode_unlock(dir->d_inode); 288 } 289 revert_creds(old_cred); --- 17 unchanged lines hidden (view full) --- 307 rdd->count = 0; 308 rdd->err = 0; 309 err = iterate_dir(realfile, &rdd->ctx); 310 if (err >= 0) 311 err = rdd->err; 312 } while (!err && rdd->count); 313 314 if (!err && rdd->first_maybe_whiteout && rdd->dentry) |
315 err = ovl_check_whiteouts(realpath->dentry, rdd); | 315 err = ovl_check_whiteouts(realpath, rdd); |
316 317 fput(realfile); 318 319 return err; 320} 321 322static void ovl_dir_reset(struct file *file) 323{ --- 150 unchanged lines hidden (view full) --- 474 goto get; 475 } 476 if (p->len == 2 && p->name[1] == '.') { 477 /* we shall not be moved */ 478 this = dget(dir->d_parent); 479 goto get; 480 } 481 } | 316 317 fput(realfile); 318 319 return err; 320} 321 322static void ovl_dir_reset(struct file *file) 323{ --- 150 unchanged lines hidden (view full) --- 474 goto get; 475 } 476 if (p->len == 2 && p->name[1] == '.') { 477 /* we shall not be moved */ 478 this = dget(dir->d_parent); 479 goto get; 480 } 481 } |
482 this = lookup_one_len(p->name, dir, p->len); | 482 this = lookup_one(mnt_user_ns(path->mnt), p->name, dir, p->len); |
483 if (IS_ERR_OR_NULL(this) || !this->d_inode) { 484 /* Mark a stale entry */ 485 p->is_whiteout = true; 486 if (IS_ERR(this)) { 487 err = PTR_ERR(this); 488 this = NULL; 489 goto fail; 490 } --- 745 unchanged lines hidden --- | 483 if (IS_ERR_OR_NULL(this) || !this->d_inode) { 484 /* Mark a stale entry */ 485 p->is_whiteout = true; 486 if (IS_ERR(this)) { 487 err = PTR_ERR(this); 488 this = NULL; 489 goto fail; 490 } --- 745 unchanged lines hidden --- |