copy_up.c 15.1 KB
Newer Older
M
Miklos Szeredi 已提交
1 2 3 4 5 6 7 8 9
/*
 *
 * Copyright (C) 2011 Novell Inc.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 as published by
 * the Free Software Foundation.
 */

10
#include <linux/module.h>
M
Miklos Szeredi 已提交
11 12 13 14 15 16 17
#include <linux/fs.h>
#include <linux/slab.h>
#include <linux/file.h>
#include <linux/splice.h>
#include <linux/xattr.h>
#include <linux/security.h>
#include <linux/uaccess.h>
18
#include <linux/sched/signal.h>
19
#include <linux/cred.h>
M
Miklos Szeredi 已提交
20
#include <linux/namei.h>
21 22
#include <linux/fdtable.h>
#include <linux/ratelimit.h>
23
#include <linux/exportfs.h>
M
Miklos Szeredi 已提交
24
#include "overlayfs.h"
25
#include "ovl_entry.h"
M
Miklos Szeredi 已提交
26 27 28

#define OVL_COPY_UP_CHUNK_SIZE (1 << 20)

29 30 31 32 33 34 35 36 37 38
static bool __read_mostly ovl_check_copy_up;
module_param_named(check_copy_up, ovl_check_copy_up, bool,
		   S_IWUSR | S_IRUGO);
MODULE_PARM_DESC(ovl_check_copy_up,
		 "Warn on copy-up when causing process also has a R/O fd open");

static int ovl_check_fd(const void *data, struct file *f, unsigned int fd)
{
	const struct dentry *dentry = data;

A
Al Viro 已提交
39
	if (file_inode(f) == d_inode(dentry))
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
		pr_warn_ratelimited("overlayfs: Warning: Copying up %pD, but open R/O on fd %u which will cease to be coherent [pid=%d %s]\n",
				    f, fd, current->pid, current->comm);
	return 0;
}

/*
 * Check the fds open by this process and warn if something like the following
 * scenario is about to occur:
 *
 *	fd1 = open("foo", O_RDONLY);
 *	fd2 = open("foo", O_RDWR);
 */
static void ovl_do_check_copy_up(struct dentry *dentry)
{
	if (ovl_check_copy_up)
		iterate_fd(current->files, 0, ovl_check_fd, dentry);
}

M
Miklos Szeredi 已提交
58 59
int ovl_copy_xattr(struct dentry *old, struct dentry *new)
{
60 61 62
	ssize_t list_size, size, value_size = 0;
	char *buf, *name, *value = NULL;
	int uninitialized_var(error);
63
	size_t slen;
M
Miklos Szeredi 已提交
64

65 66
	if (!(old->d_inode->i_opflags & IOP_XATTR) ||
	    !(new->d_inode->i_opflags & IOP_XATTR))
M
Miklos Szeredi 已提交
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
		return 0;

	list_size = vfs_listxattr(old, NULL, 0);
	if (list_size <= 0) {
		if (list_size == -EOPNOTSUPP)
			return 0;
		return list_size;
	}

	buf = kzalloc(list_size, GFP_KERNEL);
	if (!buf)
		return -ENOMEM;

	list_size = vfs_listxattr(old, buf, list_size);
	if (list_size <= 0) {
		error = list_size;
83
		goto out;
M
Miklos Szeredi 已提交
84 85
	}

86 87 88 89 90 91 92 93 94 95
	for (name = buf; list_size; name += slen) {
		slen = strnlen(name, list_size) + 1;

		/* underlying fs providing us with an broken xattr list? */
		if (WARN_ON(slen > list_size)) {
			error = -EIO;
			break;
		}
		list_size -= slen;

M
Miklos Szeredi 已提交
96 97
		if (ovl_is_private_xattr(name))
			continue;
98 99 100 101 102
retry:
		size = vfs_getxattr(old, name, value, value_size);
		if (size == -ERANGE)
			size = vfs_getxattr(old, name, NULL, 0);

M
Miklos Szeredi 已提交
103
		if (size < 0) {
M
Miklos Szeredi 已提交
104
			error = size;
105
			break;
M
Miklos Szeredi 已提交
106
		}
107 108 109 110 111 112 113 114 115 116 117 118 119 120

		if (size > value_size) {
			void *new;

			new = krealloc(value, size, GFP_KERNEL);
			if (!new) {
				error = -ENOMEM;
				break;
			}
			value = new;
			value_size = size;
			goto retry;
		}

121 122 123 124 125 126 127
		error = security_inode_copy_up_xattr(name);
		if (error < 0 && error != -EOPNOTSUPP)
			break;
		if (error == 1) {
			error = 0;
			continue; /* Discard */
		}
M
Miklos Szeredi 已提交
128 129
		error = vfs_setxattr(new, name, value, size, 0);
		if (error)
130
			break;
M
Miklos Szeredi 已提交
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
	}
	kfree(value);
out:
	kfree(buf);
	return error;
}

static int ovl_copy_up_data(struct path *old, struct path *new, loff_t len)
{
	struct file *old_file;
	struct file *new_file;
	loff_t old_pos = 0;
	loff_t new_pos = 0;
	int error = 0;

	if (len == 0)
		return 0;

149
	old_file = ovl_path_open(old, O_LARGEFILE | O_RDONLY);
M
Miklos Szeredi 已提交
150 151 152
	if (IS_ERR(old_file))
		return PTR_ERR(old_file);

153
	new_file = ovl_path_open(new, O_LARGEFILE | O_WRONLY);
M
Miklos Szeredi 已提交
154 155 156 157 158
	if (IS_ERR(new_file)) {
		error = PTR_ERR(new_file);
		goto out_fput;
	}

159 160 161 162 163 164 165
	/* Try to use clone_file_range to clone up within the same fs */
	error = vfs_clone_file_range(old_file, 0, new_file, 0, len);
	if (!error)
		goto out;
	/* Couldn't clone, so now we try to copy the data */
	error = 0;

M
Miklos Szeredi 已提交
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
	/* FIXME: copy up sparse files efficiently */
	while (len) {
		size_t this_len = OVL_COPY_UP_CHUNK_SIZE;
		long bytes;

		if (len < this_len)
			this_len = len;

		if (signal_pending_state(TASK_KILLABLE, current)) {
			error = -EINTR;
			break;
		}

		bytes = do_splice_direct(old_file, &old_pos,
					 new_file, &new_pos,
					 this_len, SPLICE_F_MOVE);
		if (bytes <= 0) {
			error = bytes;
			break;
		}
		WARN_ON(old_pos != new_pos);

		len -= bytes;
	}
190
out:
M
Miklos Szeredi 已提交
191 192
	if (!error)
		error = vfs_fsync(new_file, 0);
M
Miklos Szeredi 已提交
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235
	fput(new_file);
out_fput:
	fput(old_file);
	return error;
}

static int ovl_set_timestamps(struct dentry *upperdentry, struct kstat *stat)
{
	struct iattr attr = {
		.ia_valid =
		     ATTR_ATIME | ATTR_MTIME | ATTR_ATIME_SET | ATTR_MTIME_SET,
		.ia_atime = stat->atime,
		.ia_mtime = stat->mtime,
	};

	return notify_change(upperdentry, &attr, NULL);
}

int ovl_set_attr(struct dentry *upperdentry, struct kstat *stat)
{
	int err = 0;

	if (!S_ISLNK(stat->mode)) {
		struct iattr attr = {
			.ia_valid = ATTR_MODE,
			.ia_mode = stat->mode,
		};
		err = notify_change(upperdentry, &attr, NULL);
	}
	if (!err) {
		struct iattr attr = {
			.ia_valid = ATTR_UID | ATTR_GID,
			.ia_uid = stat->uid,
			.ia_gid = stat->gid,
		};
		err = notify_change(upperdentry, &attr, NULL);
	}
	if (!err)
		ovl_set_timestamps(upperdentry, stat);

	return err;
}

236
struct ovl_fh *ovl_encode_fh(struct dentry *lower, bool is_upper)
237 238 239 240 241
{
	struct ovl_fh *fh;
	int fh_type, fh_len, dwords;
	void *buf;
	int buflen = MAX_HANDLE_SZ;
242
	uuid_t *uuid = &lower->d_sb->s_uuid;
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274

	buf = kmalloc(buflen, GFP_TEMPORARY);
	if (!buf)
		return ERR_PTR(-ENOMEM);

	/*
	 * We encode a non-connectable file handle for non-dir, because we
	 * only need to find the lower inode number and we don't want to pay
	 * the price or reconnecting the dentry.
	 */
	dwords = buflen >> 2;
	fh_type = exportfs_encode_fh(lower, buf, &dwords, 0);
	buflen = (dwords << 2);

	fh = ERR_PTR(-EIO);
	if (WARN_ON(fh_type < 0) ||
	    WARN_ON(buflen > MAX_HANDLE_SZ) ||
	    WARN_ON(fh_type == FILEID_INVALID))
		goto out;

	BUILD_BUG_ON(MAX_HANDLE_SZ + offsetof(struct ovl_fh, fid) > 255);
	fh_len = offsetof(struct ovl_fh, fid) + buflen;
	fh = kmalloc(fh_len, GFP_KERNEL);
	if (!fh) {
		fh = ERR_PTR(-ENOMEM);
		goto out;
	}

	fh->version = OVL_FH_VERSION;
	fh->magic = OVL_FH_MAGIC;
	fh->type = fh_type;
	fh->flags = OVL_FH_FLAG_CPU_ENDIAN;
275 276 277 278 279 280 281 282
	/*
	 * When we will want to decode an overlay dentry from this handle
	 * and all layers are on the same fs, if we get a disconncted real
	 * dentry when we decode fid, the only way to tell if we should assign
	 * it to upperdentry or to lowerstack is by checking this flag.
	 */
	if (is_upper)
		fh->flags |= OVL_FH_FLAG_PATH_UPPER;
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302
	fh->len = fh_len;
	fh->uuid = *uuid;
	memcpy(fh->fid, buf, buflen);

out:
	kfree(buf);
	return fh;
}

static int ovl_set_origin(struct dentry *dentry, struct dentry *lower,
			  struct dentry *upper)
{
	const struct ovl_fh *fh = NULL;
	int err;

	/*
	 * When lower layer doesn't support export operations store a 'null' fh,
	 * so we can use the overlay.origin xattr to distignuish between a copy
	 * up and a pure upper inode.
	 */
303
	if (ovl_can_decode_fh(lower->d_sb)) {
304
		fh = ovl_encode_fh(lower, false);
305 306 307 308
		if (IS_ERR(fh))
			return PTR_ERR(fh);
	}

309 310 311 312 313
	/*
	 * Do not fail when upper doesn't support xattrs.
	 */
	err = ovl_check_setxattr(dentry, upper, OVL_XATTR_ORIGIN, fh,
				 fh ? fh->len : 0, 0);
314 315 316 317 318
	kfree(fh);

	return err;
}

319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341
static int ovl_link_up(struct dentry *parent, struct dentry *dentry)
{
	int err;
	struct dentry *upper;
	struct dentry *upperdir = ovl_dentry_upper(parent);
	struct inode *udir = d_inode(upperdir);

	inode_lock_nested(udir, I_MUTEX_PARENT);
	upper = lookup_one_len(dentry->d_name.name, upperdir,
			       dentry->d_name.len);
	err = PTR_ERR(upper);
	if (!IS_ERR(upper)) {
		err = ovl_do_link(ovl_dentry_upper(dentry), udir, upper, true);
		dput(upper);

		if (!err)
			ovl_dentry_set_upper_alias(dentry);
	}
	inode_unlock(udir);

	return err;
}

342
struct ovl_copy_up_ctx {
M
Miklos Szeredi 已提交
343
	struct dentry *parent;
344 345 346 347 348
	struct dentry *dentry;
	struct path lowerpath;
	struct kstat stat;
	struct kstat pstat;
	const char *link;
349 350
	struct dentry *destdir;
	struct qstr destname;
351 352
	struct dentry *workdir;
	bool tmpfile;
353
	bool origin;
354 355 356 357
};

static int ovl_install_temp(struct ovl_copy_up_ctx *c, struct dentry *temp,
			    struct dentry **newdentry)
358 359 360
{
	int err;
	struct dentry *upper;
361
	struct inode *udir = d_inode(c->destdir);
362

363
	upper = lookup_one_len(c->destname.name, c->destdir, c->destname.len);
364 365 366
	if (IS_ERR(upper))
		return PTR_ERR(upper);

367
	if (c->tmpfile)
368 369
		err = ovl_do_link(temp, udir, upper, true);
	else
370
		err = ovl_do_rename(d_inode(c->workdir), temp, udir, upper, 0);
371

372
	if (!err)
373
		*newdentry = dget(c->tmpfile ? upper : temp);
374 375 376 377 378
	dput(upper);

	return err;
}

379
static int ovl_get_tmpfile(struct ovl_copy_up_ctx *c, struct dentry **tempp)
M
Miklos Szeredi 已提交
380 381
{
	int err;
382
	struct dentry *temp;
383 384
	const struct cred *old_creds = NULL;
	struct cred *new_creds = NULL;
A
Al Viro 已提交
385 386
	struct cattr cattr = {
		/* Can't properly set mode on creation because of the umask */
387 388 389
		.mode = c->stat.mode & S_IFMT,
		.rdev = c->stat.rdev,
		.link = c->link
A
Al Viro 已提交
390
	};
M
Miklos Szeredi 已提交
391

392
	err = security_inode_copy_up(c->dentry, &new_creds);
393
	if (err < 0)
394
		goto out;
395 396 397 398

	if (new_creds)
		old_creds = override_creds(new_creds);

399 400
	if (c->tmpfile) {
		temp = ovl_do_tmpfile(c->workdir, c->stat.mode);
401 402 403
		if (IS_ERR(temp))
			goto temp_err;
	} else {
404
		temp = ovl_lookup_temp(c->workdir);
405 406 407
		if (IS_ERR(temp))
			goto temp_err;

408
		err = ovl_create_real(d_inode(c->workdir), temp, &cattr,
409 410 411 412 413
				      NULL, true);
		if (err) {
			dput(temp);
			goto out;
		}
414
	}
415 416 417
	err = 0;
	*tempp = temp;
out:
418 419 420 421 422
	if (new_creds) {
		revert_creds(old_creds);
		put_cred(new_creds);
	}

423 424 425 426 427 428 429
	return err;

temp_err:
	err = PTR_ERR(temp);
	goto out;
}

430
static int ovl_copy_up_inode(struct ovl_copy_up_ctx *c, struct dentry *temp)
431 432 433
{
	int err;

434
	if (S_ISREG(c->stat.mode)) {
M
Miklos Szeredi 已提交
435
		struct path upperpath;
436

437
		ovl_path_upper(c->dentry, &upperpath);
M
Miklos Szeredi 已提交
438
		BUG_ON(upperpath.dentry != NULL);
439
		upperpath.dentry = temp;
M
Miklos Szeredi 已提交
440

441
		err = ovl_copy_up_data(&c->lowerpath, &upperpath, c->stat.size);
M
Miklos Szeredi 已提交
442
		if (err)
443
			return err;
M
Miklos Szeredi 已提交
444 445
	}

446
	err = ovl_copy_xattr(c->lowerpath.dentry, temp);
M
Miklos Szeredi 已提交
447
	if (err)
448
		return err;
M
Miklos Szeredi 已提交
449

450
	inode_lock(temp->d_inode);
451
	err = ovl_set_attr(temp, &c->stat);
452
	inode_unlock(temp->d_inode);
M
Miklos Szeredi 已提交
453
	if (err)
454
		return err;
M
Miklos Szeredi 已提交
455

456 457 458
	/*
	 * Store identifier of lower inode in upper inode xattr to
	 * allow lookup of the copy up origin inode.
459 460 461
	 *
	 * Don't set origin when we are breaking the association with a lower
	 * hard link.
462
	 */
463
	if (c->origin) {
464
		err = ovl_set_origin(c->dentry, c->lowerpath.dentry, temp);
465
		if (err)
466
			return err;
467
	}
468

469 470 471
	return 0;
}

472
static int ovl_copy_up_locked(struct ovl_copy_up_ctx *c)
473
{
474
	struct inode *udir = c->destdir->d_inode;
475 476 477 478
	struct dentry *newdentry = NULL;
	struct dentry *temp = NULL;
	int err;

479
	err = ovl_get_tmpfile(c, &temp);
480 481 482
	if (err)
		goto out;

483
	err = ovl_copy_up_inode(c, temp);
484 485 486
	if (err)
		goto out_cleanup;

487
	if (c->tmpfile) {
488
		inode_lock_nested(udir, I_MUTEX_PARENT);
489
		err = ovl_install_temp(c, temp, &newdentry);
490 491
		inode_unlock(udir);
	} else {
492
		err = ovl_install_temp(c, temp, &newdentry);
493
	}
M
Miklos Szeredi 已提交
494 495 496
	if (err)
		goto out_cleanup;

497
	ovl_inode_update(d_inode(c->dentry), newdentry);
498
out:
499
	dput(temp);
M
Miklos Szeredi 已提交
500 501 502
	return err;

out_cleanup:
503 504
	if (!c->tmpfile)
		ovl_cleanup(d_inode(c->workdir), temp);
505
	goto out;
M
Miklos Szeredi 已提交
506 507 508 509 510
}

/*
 * Copy up a single dentry
 *
M
Miklos Szeredi 已提交
511 512 513 514 515
 * All renames start with copy up of source if necessary.  The actual
 * rename will only proceed once the copy up was successful.  Copy up uses
 * upper parent i_mutex for exclusion.  Since rename can change d_parent it
 * is possible that the copy up will lock the old parent.  At that point
 * the file will have already been copied up anyway.
M
Miklos Szeredi 已提交
516
 */
M
Miklos Szeredi 已提交
517
static int ovl_do_copy_up(struct ovl_copy_up_ctx *c)
M
Miklos Szeredi 已提交
518 519
{
	int err;
520
	struct ovl_fs *ofs = c->dentry->d_sb->s_fs_info;
521
	bool indexed = false;
M
Miklos Szeredi 已提交
522

523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543
	if (ovl_indexdir(c->dentry->d_sb) && !S_ISDIR(c->stat.mode) &&
	    c->stat.nlink > 1)
		indexed = true;

	if (S_ISDIR(c->stat.mode) || c->stat.nlink == 1 || indexed)
		c->origin = true;

	if (indexed) {
		c->destdir = ovl_indexdir(c->dentry->d_sb);
		err = ovl_get_index_name(c->lowerpath.dentry, &c->destname);
		if (err)
			return err;
	} else {
		/*
		 * Mark parent "impure" because it may now contain non-pure
		 * upper
		 */
		err = ovl_set_impure(c->parent, c->destdir);
		if (err)
			return err;
	}
M
Miklos Szeredi 已提交
544

545
	/* Should we copyup with O_TMPFILE or with workdir? */
546 547
	if (S_ISREG(c->stat.mode) && ofs->tmpfile) {
		c->tmpfile = true;
548 549 550 551 552 553 554 555 556
		err = ovl_copy_up_locked(c);
	} else {
		err = -EIO;
		if (lock_rename(c->workdir, c->destdir) != NULL) {
			pr_err("overlayfs: failed to lock workdir+upperdir\n");
		} else {
			err = ovl_copy_up_locked(c);
			unlock_rename(c->workdir, c->destdir);
		}
557 558
	}

559 560 561 562 563 564 565 566 567 568 569 570 571
	if (indexed) {
		if (!err)
			ovl_set_flag(OVL_INDEX, d_inode(c->dentry));
		kfree(c->destname.name);
	} else if (!err) {
		struct inode *udir = d_inode(c->destdir);

		/* Restore timestamps on parent (best effort) */
		inode_lock(udir);
		ovl_set_timestamps(c->destdir, &c->pstat);
		inode_unlock(udir);

		ovl_dentry_set_upper_alias(c->dentry);
M
Miklos Szeredi 已提交
572 573
	}

M
Miklos Szeredi 已提交
574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598
	return err;
}

static int ovl_copy_up_one(struct dentry *parent, struct dentry *dentry,
			   int flags)
{
	int err;
	DEFINE_DELAYED_CALL(done);
	struct path parentpath;
	struct ovl_copy_up_ctx ctx = {
		.parent = parent,
		.dentry = dentry,
		.workdir = ovl_workdir(dentry),
	};

	if (WARN_ON(!ctx.workdir))
		return -EROFS;

	ovl_path_lower(dentry, &ctx.lowerpath);
	err = vfs_getattr(&ctx.lowerpath, &ctx.stat,
			  STATX_BASIC_STATS, AT_STATX_SYNC_AS_STAT);
	if (err)
		return err;

	ovl_path_upper(parent, &parentpath);
599 600
	ctx.destdir = parentpath.dentry;
	ctx.destname = dentry->d_name;
M
Miklos Szeredi 已提交
601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617

	err = vfs_getattr(&parentpath, &ctx.pstat,
			  STATX_ATIME | STATX_MTIME, AT_STATX_SYNC_AS_STAT);
	if (err)
		return err;

	/* maybe truncate regular file. this has no effect on dirs */
	if (flags & O_TRUNC)
		ctx.stat.size = 0;

	if (S_ISLNK(ctx.stat.mode)) {
		ctx.link = vfs_get_link(ctx.lowerpath.dentry, &done);
		if (IS_ERR(ctx.link))
			return PTR_ERR(ctx.link);
	}
	ovl_do_check_copy_up(ctx.lowerpath.dentry);

M
Miklos Szeredi 已提交
618 619 620 621 622 623
	err = ovl_copy_up_start(dentry);
	/* err < 0: interrupted, err > 0: raced with another copy-up */
	if (unlikely(err)) {
		if (err > 0)
			err = 0;
	} else {
624 625 626 627
		if (!ovl_dentry_upper(dentry))
			err = ovl_do_copy_up(&ctx);
		if (!err && !ovl_dentry_has_upper_alias(dentry))
			err = ovl_link_up(parent, dentry);
M
Miklos Szeredi 已提交
628 629
		ovl_copy_up_end(dentry);
	}
M
Miklos Szeredi 已提交
630
	do_delayed_call(&done);
M
Miklos Szeredi 已提交
631 632 633 634

	return err;
}

635
int ovl_copy_up_flags(struct dentry *dentry, int flags)
M
Miklos Szeredi 已提交
636
{
637 638
	int err = 0;
	const struct cred *old_cred = ovl_override_creds(dentry->d_sb);
M
Miklos Szeredi 已提交
639 640 641 642 643

	while (!err) {
		struct dentry *next;
		struct dentry *parent;

644 645 646 647 648 649 650 651 652 653 654 655 656 657 658
		/*
		 * Check if copy-up has happened as well as for upper alias (in
		 * case of hard links) is there.
		 *
		 * Both checks are lockless:
		 *  - false negatives: will recheck under oi->lock
		 *  - false positives:
		 *    + ovl_dentry_upper() uses memory barriers to ensure the
		 *      upper dentry is up-to-date
		 *    + ovl_dentry_has_upper_alias() relies on locking of
		 *      upper parent i_rwsem to prevent reordering copy-up
		 *      with rename.
		 */
		if (ovl_dentry_upper(dentry) &&
		    ovl_dentry_has_upper_alias(dentry))
M
Miklos Szeredi 已提交
659 660 661 662 663 664 665
			break;

		next = dget(dentry);
		/* find the topmost dentry not yet copied up */
		for (;;) {
			parent = dget_parent(next);

666
			if (ovl_dentry_upper(parent))
M
Miklos Szeredi 已提交
667 668 669 670 671 672
				break;

			dput(next);
			next = parent;
		}

M
Miklos Szeredi 已提交
673
		err = ovl_copy_up_one(parent, next, flags);
M
Miklos Szeredi 已提交
674 675 676 677

		dput(parent);
		dput(next);
	}
678
	revert_creds(old_cred);
M
Miklos Szeredi 已提交
679 680 681

	return err;
}
682 683 684 685 686

int ovl_copy_up(struct dentry *dentry)
{
	return ovl_copy_up_flags(dentry, 0);
}