blob: 3cc65e60df02bc9882fd120359b0306cf4b0ddad [file] [log] [blame]
Miklos Szeredie9be9d52014-10-24 00:14:38 +02001/*
2 *
3 * Copyright (C) 2011 Novell Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
8 */
9
10#include <linux/fs.h>
11#include <linux/namei.h>
12#include <linux/xattr.h>
13#include <linux/security.h>
14#include <linux/cred.h>
Miklos Szeredi3ea22a72016-12-16 11:02:57 +010015#include <linux/module.h>
Miklos Szeredi38b25692016-09-01 11:11:59 +020016#include <linux/posix_acl.h>
17#include <linux/posix_acl_xattr.h>
Richard Weinberger6a45b362016-09-16 11:45:24 +020018#include <linux/atomic.h>
Miklos Szeredia6c60652016-12-16 11:02:56 +010019#include <linux/ratelimit.h>
Miklos Szeredie9be9d52014-10-24 00:14:38 +020020#include "overlayfs.h"
21
Miklos Szeredi3ea22a72016-12-16 11:02:57 +010022static unsigned short ovl_redirect_max = 256;
23module_param_named(redirect_max, ovl_redirect_max, ushort, 0644);
24MODULE_PARM_DESC(ovl_redirect_max,
25 "Maximum length of absolute redirect xattr value");
26
Miklos Szeredie9be9d52014-10-24 00:14:38 +020027void ovl_cleanup(struct inode *wdir, struct dentry *wdentry)
28{
29 int err;
30
31 dget(wdentry);
David Howellse36cb0b2015-01-29 12:02:35 +000032 if (d_is_dir(wdentry))
Miklos Szeredie9be9d52014-10-24 00:14:38 +020033 err = ovl_do_rmdir(wdir, wdentry);
34 else
35 err = ovl_do_unlink(wdir, wdentry);
36 dput(wdentry);
37
38 if (err) {
39 pr_err("overlayfs: cleanup of '%pd2' failed (%i)\n",
40 wdentry, err);
41 }
42}
43
44struct dentry *ovl_lookup_temp(struct dentry *workdir, struct dentry *dentry)
45{
46 struct dentry *temp;
47 char name[20];
Richard Weinberger6a45b362016-09-16 11:45:24 +020048 static atomic_t temp_id = ATOMIC_INIT(0);
Miklos Szeredie9be9d52014-10-24 00:14:38 +020049
Richard Weinberger6a45b362016-09-16 11:45:24 +020050 /* counter is allowed to wrap, since temp dentries are ephemeral */
51 snprintf(name, sizeof(name), "#%x", atomic_inc_return(&temp_id));
Miklos Szeredie9be9d52014-10-24 00:14:38 +020052
53 temp = lookup_one_len(name, workdir, strlen(name));
54 if (!IS_ERR(temp) && temp->d_inode) {
55 pr_err("overlayfs: workdir/%s already exists\n", name);
56 dput(temp);
57 temp = ERR_PTR(-EIO);
58 }
59
60 return temp;
61}
62
63/* caller holds i_mutex on workdir */
64static struct dentry *ovl_whiteout(struct dentry *workdir,
65 struct dentry *dentry)
66{
67 int err;
68 struct dentry *whiteout;
69 struct inode *wdir = workdir->d_inode;
70
71 whiteout = ovl_lookup_temp(workdir, dentry);
72 if (IS_ERR(whiteout))
73 return whiteout;
74
75 err = ovl_do_whiteout(wdir, whiteout);
76 if (err) {
77 dput(whiteout);
78 whiteout = ERR_PTR(err);
79 }
80
81 return whiteout;
82}
83
84int ovl_create_real(struct inode *dir, struct dentry *newdentry,
85 struct kstat *stat, const char *link,
86 struct dentry *hardlink, bool debug)
87{
88 int err;
89
90 if (newdentry->d_inode)
91 return -ESTALE;
92
93 if (hardlink) {
94 err = ovl_do_link(hardlink, dir, newdentry, debug);
95 } else {
96 switch (stat->mode & S_IFMT) {
97 case S_IFREG:
98 err = ovl_do_create(dir, newdentry, stat->mode, debug);
99 break;
100
101 case S_IFDIR:
102 err = ovl_do_mkdir(dir, newdentry, stat->mode, debug);
103 break;
104
105 case S_IFCHR:
106 case S_IFBLK:
107 case S_IFIFO:
108 case S_IFSOCK:
109 err = ovl_do_mknod(dir, newdentry,
110 stat->mode, stat->rdev, debug);
111 break;
112
113 case S_IFLNK:
114 err = ovl_do_symlink(dir, newdentry, link, debug);
115 break;
116
117 default:
118 err = -EPERM;
119 }
120 }
121 if (!err && WARN_ON(!newdentry->d_inode)) {
122 /*
123 * Not quite sure if non-instantiated dentry is legal or not.
124 * VFS doesn't seem to care so check and warn here.
125 */
126 err = -ENOENT;
127 }
128 return err;
129}
130
Miklos Szeredi5cf5b472016-12-16 11:02:57 +0100131static int ovl_set_opaque(struct dentry *dentry, struct dentry *upperdentry)
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200132{
Miklos Szeredi5cf5b472016-12-16 11:02:57 +0100133 int err;
134
135 err = ovl_do_setxattr(upperdentry, OVL_XATTR_OPAQUE, "y", 1, 0);
136 if (!err)
137 ovl_dentry_set_opaque(dentry);
138
139 return err;
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200140}
141
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200142static int ovl_dir_getattr(struct vfsmount *mnt, struct dentry *dentry,
143 struct kstat *stat)
144{
145 int err;
146 enum ovl_path_type type;
147 struct path realpath;
Vivek Goyal1175b6b2016-07-01 16:34:28 -0400148 const struct cred *old_cred;
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200149
150 type = ovl_path_real(dentry, &realpath);
Vivek Goyal1175b6b2016-07-01 16:34:28 -0400151 old_cred = ovl_override_creds(dentry->d_sb);
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200152 err = vfs_getattr(&realpath, stat);
Vivek Goyal1175b6b2016-07-01 16:34:28 -0400153 revert_creds(old_cred);
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200154 if (err)
155 return err;
156
157 stat->dev = dentry->d_sb->s_dev;
158 stat->ino = dentry->d_inode->i_ino;
159
160 /*
161 * It's probably not worth it to count subdirs to get the
162 * correct link count. nlink=1 seems to pacify 'find' and
163 * other utilities.
164 */
Miklos Szeredi1afaba12014-12-13 00:59:42 +0100165 if (OVL_TYPE_MERGE(type))
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200166 stat->nlink = 1;
167
168 return 0;
169}
170
Vivek Goyal72e48482016-06-16 10:09:14 -0400171/* Common operations required to be done after creation of file on upper */
172static void ovl_instantiate(struct dentry *dentry, struct inode *inode,
Miklos Szeredi51f7e522016-07-29 12:05:24 +0200173 struct dentry *newdentry, bool hardlink)
Vivek Goyal72e48482016-06-16 10:09:14 -0400174{
175 ovl_dentry_version_inc(dentry->d_parent);
176 ovl_dentry_update(dentry, newdentry);
Miklos Szeredi51f7e522016-07-29 12:05:24 +0200177 if (!hardlink) {
178 ovl_inode_update(inode, d_inode(newdentry));
179 ovl_copyattr(newdentry->d_inode, inode);
180 } else {
181 WARN_ON(ovl_inode_real(inode, NULL) != d_inode(newdentry));
182 inc_nlink(inode);
183 }
Vivek Goyal72e48482016-06-16 10:09:14 -0400184 d_instantiate(dentry, inode);
185}
186
Amir Goldstein97c684c2016-11-21 18:57:34 +0200187static bool ovl_type_merge(struct dentry *dentry)
188{
189 return OVL_TYPE_MERGE(ovl_path_type(dentry));
190}
191
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200192static int ovl_create_upper(struct dentry *dentry, struct inode *inode,
193 struct kstat *stat, const char *link,
194 struct dentry *hardlink)
195{
196 struct dentry *upperdir = ovl_dentry_upper(dentry->d_parent);
197 struct inode *udir = upperdir->d_inode;
198 struct dentry *newdentry;
199 int err;
200
Miklos Szeredi38b25692016-09-01 11:11:59 +0200201 if (!hardlink && !IS_POSIXACL(udir))
202 stat->mode &= ~current_umask();
203
Al Viro59551022016-01-22 15:40:57 -0500204 inode_lock_nested(udir, I_MUTEX_PARENT);
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200205 newdentry = lookup_one_len(dentry->d_name.name, upperdir,
206 dentry->d_name.len);
207 err = PTR_ERR(newdentry);
208 if (IS_ERR(newdentry))
209 goto out_unlock;
210 err = ovl_create_real(udir, newdentry, stat, link, hardlink, false);
211 if (err)
212 goto out_dput;
213
Amir Goldstein97c684c2016-11-21 18:57:34 +0200214 if (ovl_type_merge(dentry->d_parent)) {
215 /* Setting opaque here is just an optimization, allow to fail */
216 ovl_set_opaque(dentry, newdentry);
217 }
218
Miklos Szeredi51f7e522016-07-29 12:05:24 +0200219 ovl_instantiate(dentry, inode, newdentry, !!hardlink);
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200220 newdentry = NULL;
221out_dput:
222 dput(newdentry);
223out_unlock:
Al Viro59551022016-01-22 15:40:57 -0500224 inode_unlock(udir);
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200225 return err;
226}
227
228static int ovl_lock_rename_workdir(struct dentry *workdir,
229 struct dentry *upperdir)
230{
231 /* Workdir should not be the same as upperdir */
232 if (workdir == upperdir)
233 goto err;
234
235 /* Workdir should not be subdir of upperdir and vice versa */
236 if (lock_rename(workdir, upperdir) != NULL)
237 goto err_unlock;
238
239 return 0;
240
241err_unlock:
242 unlock_rename(workdir, upperdir);
243err:
244 pr_err("overlayfs: failed to lock workdir+upperdir\n");
245 return -EIO;
246}
247
248static struct dentry *ovl_clear_empty(struct dentry *dentry,
249 struct list_head *list)
250{
251 struct dentry *workdir = ovl_workdir(dentry);
252 struct inode *wdir = workdir->d_inode;
253 struct dentry *upperdir = ovl_dentry_upper(dentry->d_parent);
254 struct inode *udir = upperdir->d_inode;
255 struct path upperpath;
256 struct dentry *upper;
257 struct dentry *opaquedir;
258 struct kstat stat;
259 int err;
260
Miklos Szeredicc6f67b2015-05-19 14:30:12 +0200261 if (WARN_ON(!workdir))
262 return ERR_PTR(-EROFS);
263
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200264 err = ovl_lock_rename_workdir(workdir, upperdir);
265 if (err)
266 goto out;
267
268 ovl_path_upper(dentry, &upperpath);
269 err = vfs_getattr(&upperpath, &stat);
270 if (err)
271 goto out_unlock;
272
273 err = -ESTALE;
274 if (!S_ISDIR(stat.mode))
275 goto out_unlock;
276 upper = upperpath.dentry;
277 if (upper->d_parent->d_inode != udir)
278 goto out_unlock;
279
280 opaquedir = ovl_lookup_temp(workdir, dentry);
281 err = PTR_ERR(opaquedir);
282 if (IS_ERR(opaquedir))
283 goto out_unlock;
284
285 err = ovl_create_real(wdir, opaquedir, &stat, NULL, NULL, true);
286 if (err)
287 goto out_dput;
288
289 err = ovl_copy_xattr(upper, opaquedir);
290 if (err)
291 goto out_cleanup;
292
Miklos Szeredi5cf5b472016-12-16 11:02:57 +0100293 err = ovl_set_opaque(dentry, opaquedir);
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200294 if (err)
295 goto out_cleanup;
296
Al Viro59551022016-01-22 15:40:57 -0500297 inode_lock(opaquedir->d_inode);
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200298 err = ovl_set_attr(opaquedir, &stat);
Al Viro59551022016-01-22 15:40:57 -0500299 inode_unlock(opaquedir->d_inode);
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200300 if (err)
301 goto out_cleanup;
302
303 err = ovl_do_rename(wdir, opaquedir, udir, upper, RENAME_EXCHANGE);
304 if (err)
305 goto out_cleanup;
306
307 ovl_cleanup_whiteouts(upper, list);
308 ovl_cleanup(wdir, upper);
309 unlock_rename(workdir, upperdir);
310
311 /* dentry's upper doesn't match now, get rid of it */
312 d_drop(dentry);
313
314 return opaquedir;
315
316out_cleanup:
317 ovl_cleanup(wdir, opaquedir);
318out_dput:
319 dput(opaquedir);
320out_unlock:
321 unlock_rename(workdir, upperdir);
322out:
323 return ERR_PTR(err);
324}
325
Miklos Szeredia105d682014-11-20 16:39:59 +0100326static struct dentry *ovl_check_empty_and_clear(struct dentry *dentry)
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200327{
328 int err;
329 struct dentry *ret = NULL;
Miklos Szeredi30c17eb2016-07-29 12:05:25 +0200330 enum ovl_path_type type = ovl_path_type(dentry);
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200331 LIST_HEAD(list);
332
333 err = ovl_check_empty_dir(dentry, &list);
Miklos Szeredi30c17eb2016-07-29 12:05:25 +0200334 if (err) {
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200335 ret = ERR_PTR(err);
Miklos Szeredi30c17eb2016-07-29 12:05:25 +0200336 goto out_free;
Miklos Szeredia105d682014-11-20 16:39:59 +0100337 }
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200338
Miklos Szeredi30c17eb2016-07-29 12:05:25 +0200339 /*
340 * When removing an empty opaque directory, then it makes no sense to
341 * replace it with an exact replica of itself.
342 *
343 * If no upperdentry then skip clearing whiteouts.
344 *
345 * Can race with copy-up, since we don't hold the upperdir mutex.
346 * Doesn't matter, since copy-up can't create a non-empty directory
347 * from an empty one.
348 */
349 if (OVL_TYPE_UPPER(type) && OVL_TYPE_MERGE(type))
350 ret = ovl_clear_empty(dentry, &list);
351
352out_free:
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200353 ovl_cache_free(&list);
354
355 return ret;
356}
357
Miklos Szeredi38b25692016-09-01 11:11:59 +0200358static int ovl_set_upper_acl(struct dentry *upperdentry, const char *name,
359 const struct posix_acl *acl)
360{
361 void *buffer;
362 size_t size;
363 int err;
364
365 if (!IS_ENABLED(CONFIG_FS_POSIX_ACL) || !acl)
366 return 0;
367
368 size = posix_acl_to_xattr(NULL, acl, NULL, 0);
369 buffer = kmalloc(size, GFP_KERNEL);
370 if (!buffer)
371 return -ENOMEM;
372
373 size = posix_acl_to_xattr(&init_user_ns, acl, buffer, size);
374 err = size;
375 if (err < 0)
376 goto out_free;
377
378 err = vfs_setxattr(upperdentry, name, buffer, size, XATTR_CREATE);
379out_free:
380 kfree(buffer);
381 return err;
382}
383
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200384static int ovl_create_over_whiteout(struct dentry *dentry, struct inode *inode,
385 struct kstat *stat, const char *link,
386 struct dentry *hardlink)
387{
388 struct dentry *workdir = ovl_workdir(dentry);
389 struct inode *wdir = workdir->d_inode;
390 struct dentry *upperdir = ovl_dentry_upper(dentry->d_parent);
391 struct inode *udir = upperdir->d_inode;
392 struct dentry *upper;
393 struct dentry *newdentry;
394 int err;
Miklos Szeredi38b25692016-09-01 11:11:59 +0200395 struct posix_acl *acl, *default_acl;
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200396
Miklos Szeredicc6f67b2015-05-19 14:30:12 +0200397 if (WARN_ON(!workdir))
398 return -EROFS;
399
Miklos Szeredi38b25692016-09-01 11:11:59 +0200400 if (!hardlink) {
401 err = posix_acl_create(dentry->d_parent->d_inode,
402 &stat->mode, &default_acl, &acl);
403 if (err)
404 return err;
405 }
406
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200407 err = ovl_lock_rename_workdir(workdir, upperdir);
408 if (err)
409 goto out;
410
411 newdentry = ovl_lookup_temp(workdir, dentry);
412 err = PTR_ERR(newdentry);
413 if (IS_ERR(newdentry))
414 goto out_unlock;
415
416 upper = lookup_one_len(dentry->d_name.name, upperdir,
417 dentry->d_name.len);
418 err = PTR_ERR(upper);
419 if (IS_ERR(upper))
420 goto out_dput;
421
422 err = ovl_create_real(wdir, newdentry, stat, link, hardlink, true);
423 if (err)
424 goto out_dput2;
425
Miklos Szeredibb0d2b82016-07-29 12:05:23 +0200426 /*
427 * mode could have been mutilated due to umask (e.g. sgid directory)
428 */
Miklos Szeredi51f7e522016-07-29 12:05:24 +0200429 if (!hardlink &&
430 !S_ISLNK(stat->mode) && newdentry->d_inode->i_mode != stat->mode) {
Miklos Szeredibb0d2b82016-07-29 12:05:23 +0200431 struct iattr attr = {
432 .ia_valid = ATTR_MODE,
433 .ia_mode = stat->mode,
434 };
435 inode_lock(newdentry->d_inode);
436 err = notify_change(newdentry, &attr, NULL);
437 inode_unlock(newdentry->d_inode);
438 if (err)
439 goto out_cleanup;
440 }
Miklos Szeredi38b25692016-09-01 11:11:59 +0200441 if (!hardlink) {
442 err = ovl_set_upper_acl(newdentry, XATTR_NAME_POSIX_ACL_ACCESS,
443 acl);
444 if (err)
445 goto out_cleanup;
446
447 err = ovl_set_upper_acl(newdentry, XATTR_NAME_POSIX_ACL_DEFAULT,
448 default_acl);
449 if (err)
450 goto out_cleanup;
451 }
Miklos Szeredibb0d2b82016-07-29 12:05:23 +0200452
Miklos Szeredi51f7e522016-07-29 12:05:24 +0200453 if (!hardlink && S_ISDIR(stat->mode)) {
Miklos Szeredi5cf5b472016-12-16 11:02:57 +0100454 err = ovl_set_opaque(dentry, newdentry);
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200455 if (err)
456 goto out_cleanup;
457
458 err = ovl_do_rename(wdir, newdentry, udir, upper,
459 RENAME_EXCHANGE);
460 if (err)
461 goto out_cleanup;
462
463 ovl_cleanup(wdir, upper);
464 } else {
465 err = ovl_do_rename(wdir, newdentry, udir, upper, 0);
466 if (err)
467 goto out_cleanup;
468 }
Miklos Szeredi51f7e522016-07-29 12:05:24 +0200469 ovl_instantiate(dentry, inode, newdentry, !!hardlink);
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200470 newdentry = NULL;
471out_dput2:
472 dput(upper);
473out_dput:
474 dput(newdentry);
475out_unlock:
476 unlock_rename(workdir, upperdir);
477out:
Miklos Szeredi38b25692016-09-01 11:11:59 +0200478 if (!hardlink) {
479 posix_acl_release(acl);
480 posix_acl_release(default_acl);
481 }
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200482 return err;
483
484out_cleanup:
485 ovl_cleanup(wdir, newdentry);
486 goto out_dput2;
487}
488
Miklos Szeredi51f7e522016-07-29 12:05:24 +0200489static int ovl_create_or_link(struct dentry *dentry, struct inode *inode,
490 struct kstat *stat, const char *link,
491 struct dentry *hardlink)
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200492{
493 int err;
Vivek Goyal1175b6b2016-07-01 16:34:28 -0400494 const struct cred *old_cred;
495 struct cred *override_cred;
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200496
497 err = ovl_copy_up(dentry->d_parent);
498 if (err)
Miklos Szeredi51f7e522016-07-29 12:05:24 +0200499 return err;
Miklos Szeredibb0d2b82016-07-29 12:05:23 +0200500
Vivek Goyal1175b6b2016-07-01 16:34:28 -0400501 old_cred = ovl_override_creds(dentry->d_sb);
502 err = -ENOMEM;
503 override_cred = prepare_creds();
504 if (override_cred) {
Miklos Szeredibb0d2b82016-07-29 12:05:23 +0200505 override_cred->fsuid = inode->i_uid;
506 override_cred->fsgid = inode->i_gid;
Vivek Goyal26026252016-07-13 10:44:52 -0400507 if (!hardlink) {
508 err = security_dentry_create_files_as(dentry,
509 stat->mode, &dentry->d_name, old_cred,
510 override_cred);
511 if (err) {
512 put_cred(override_cred);
513 goto out_revert_creds;
514 }
515 }
Vivek Goyal1175b6b2016-07-01 16:34:28 -0400516 put_cred(override_creds(override_cred));
517 put_cred(override_cred);
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200518
Miklos Szeredic412ce42016-12-16 11:02:55 +0100519 if (!ovl_dentry_is_whiteout(dentry))
Miklos Szeredi51f7e522016-07-29 12:05:24 +0200520 err = ovl_create_upper(dentry, inode, stat, link,
Vivek Goyal1175b6b2016-07-01 16:34:28 -0400521 hardlink);
522 else
Miklos Szeredi51f7e522016-07-29 12:05:24 +0200523 err = ovl_create_over_whiteout(dentry, inode, stat,
Vivek Goyal1175b6b2016-07-01 16:34:28 -0400524 link, hardlink);
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200525 }
Vivek Goyal26026252016-07-13 10:44:52 -0400526out_revert_creds:
Vivek Goyal1175b6b2016-07-01 16:34:28 -0400527 revert_creds(old_cred);
Miklos Szeredibb0d2b82016-07-29 12:05:23 +0200528 if (!err) {
529 struct inode *realinode = d_inode(ovl_dentry_upper(dentry));
530
531 WARN_ON(inode->i_mode != realinode->i_mode);
532 WARN_ON(!uid_eq(inode->i_uid, realinode->i_uid));
533 WARN_ON(!gid_eq(inode->i_gid, realinode->i_gid));
Miklos Szeredibb0d2b82016-07-29 12:05:23 +0200534 }
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200535 return err;
536}
537
538static int ovl_create_object(struct dentry *dentry, int mode, dev_t rdev,
539 const char *link)
540{
541 int err;
Miklos Szeredi51f7e522016-07-29 12:05:24 +0200542 struct inode *inode;
543 struct kstat stat = {
544 .rdev = rdev,
545 };
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200546
547 err = ovl_want_write(dentry);
Miklos Szeredi51f7e522016-07-29 12:05:24 +0200548 if (err)
549 goto out;
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200550
Miklos Szeredi51f7e522016-07-29 12:05:24 +0200551 err = -ENOMEM;
Miklos Szeredica4c8a32016-12-16 11:02:55 +0100552 inode = ovl_new_inode(dentry->d_sb, mode, rdev);
Miklos Szeredi51f7e522016-07-29 12:05:24 +0200553 if (!inode)
554 goto out_drop_write;
555
556 inode_init_owner(inode, dentry->d_parent->d_inode, mode);
557 stat.mode = inode->i_mode;
558
559 err = ovl_create_or_link(dentry, inode, &stat, link, NULL);
560 if (err)
561 iput(inode);
562
563out_drop_write:
564 ovl_drop_write(dentry);
565out:
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200566 return err;
567}
568
569static int ovl_create(struct inode *dir, struct dentry *dentry, umode_t mode,
570 bool excl)
571{
572 return ovl_create_object(dentry, (mode & 07777) | S_IFREG, 0, NULL);
573}
574
575static int ovl_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
576{
577 return ovl_create_object(dentry, (mode & 07777) | S_IFDIR, 0, NULL);
578}
579
580static int ovl_mknod(struct inode *dir, struct dentry *dentry, umode_t mode,
581 dev_t rdev)
582{
583 /* Don't allow creation of "whiteout" on overlay */
584 if (S_ISCHR(mode) && rdev == WHITEOUT_DEV)
585 return -EPERM;
586
587 return ovl_create_object(dentry, mode, rdev, NULL);
588}
589
590static int ovl_symlink(struct inode *dir, struct dentry *dentry,
591 const char *link)
592{
593 return ovl_create_object(dentry, S_IFLNK, 0, link);
594}
595
596static int ovl_link(struct dentry *old, struct inode *newdir,
597 struct dentry *new)
598{
599 int err;
Miklos Szeredi51f7e522016-07-29 12:05:24 +0200600 struct inode *inode;
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200601
602 err = ovl_want_write(old);
603 if (err)
604 goto out;
605
606 err = ovl_copy_up(old);
607 if (err)
608 goto out_drop_write;
609
Miklos Szeredi51f7e522016-07-29 12:05:24 +0200610 inode = d_inode(old);
611 ihold(inode);
612
613 err = ovl_create_or_link(new, inode, NULL, NULL, ovl_dentry_upper(old));
614 if (err)
615 iput(inode);
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200616
617out_drop_write:
618 ovl_drop_write(old);
619out:
620 return err;
621}
622
Miklos Szeredia105d682014-11-20 16:39:59 +0100623static int ovl_remove_and_whiteout(struct dentry *dentry, bool is_dir)
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200624{
625 struct dentry *workdir = ovl_workdir(dentry);
626 struct inode *wdir = workdir->d_inode;
627 struct dentry *upperdir = ovl_dentry_upper(dentry->d_parent);
628 struct inode *udir = upperdir->d_inode;
629 struct dentry *whiteout;
630 struct dentry *upper;
631 struct dentry *opaquedir = NULL;
632 int err;
Maxim Patlasovcfc9fde2016-07-21 18:24:26 -0700633 int flags = 0;
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200634
Miklos Szeredicc6f67b2015-05-19 14:30:12 +0200635 if (WARN_ON(!workdir))
636 return -EROFS;
637
Miklos Szeredid377c5e2015-05-14 10:04:44 +0200638 if (is_dir) {
Miklos Szeredi30c17eb2016-07-29 12:05:25 +0200639 opaquedir = ovl_check_empty_and_clear(dentry);
640 err = PTR_ERR(opaquedir);
641 if (IS_ERR(opaquedir))
642 goto out;
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200643 }
644
645 err = ovl_lock_rename_workdir(workdir, upperdir);
646 if (err)
647 goto out_dput;
648
Maxim Patlasovcfc9fde2016-07-21 18:24:26 -0700649 upper = lookup_one_len(dentry->d_name.name, upperdir,
650 dentry->d_name.len);
651 err = PTR_ERR(upper);
652 if (IS_ERR(upper))
653 goto out_unlock;
654
655 err = -ESTALE;
656 if ((opaquedir && upper != opaquedir) ||
657 (!opaquedir && ovl_dentry_upper(dentry) &&
658 upper != ovl_dentry_upper(dentry))) {
659 goto out_dput_upper;
660 }
661
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200662 whiteout = ovl_whiteout(workdir, dentry);
663 err = PTR_ERR(whiteout);
664 if (IS_ERR(whiteout))
Maxim Patlasovcfc9fde2016-07-21 18:24:26 -0700665 goto out_dput_upper;
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200666
Maxim Patlasovcfc9fde2016-07-21 18:24:26 -0700667 if (d_is_dir(upper))
668 flags = RENAME_EXCHANGE;
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200669
Maxim Patlasovcfc9fde2016-07-21 18:24:26 -0700670 err = ovl_do_rename(wdir, whiteout, udir, upper, flags);
671 if (err)
672 goto kill_whiteout;
673 if (flags)
674 ovl_cleanup(wdir, upper);
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200675
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200676 ovl_dentry_version_inc(dentry->d_parent);
677out_d_drop:
678 d_drop(dentry);
679 dput(whiteout);
Maxim Patlasovcfc9fde2016-07-21 18:24:26 -0700680out_dput_upper:
681 dput(upper);
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200682out_unlock:
683 unlock_rename(workdir, upperdir);
684out_dput:
685 dput(opaquedir);
686out:
687 return err;
688
689kill_whiteout:
690 ovl_cleanup(wdir, whiteout);
691 goto out_d_drop;
692}
693
694static int ovl_remove_upper(struct dentry *dentry, bool is_dir)
695{
696 struct dentry *upperdir = ovl_dentry_upper(dentry->d_parent);
697 struct inode *dir = upperdir->d_inode;
Miklos Szeredi11f37102016-03-21 17:31:44 +0100698 struct dentry *upper;
Amir Goldsteind1595112016-10-26 12:34:06 +0300699 struct dentry *opaquedir = NULL;
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200700 int err;
701
Amir Goldsteind1595112016-10-26 12:34:06 +0300702 /* Redirect dir can be !ovl_lower_positive && OVL_TYPE_MERGE */
703 if (is_dir && ovl_dentry_get_redirect(dentry)) {
704 opaquedir = ovl_check_empty_and_clear(dentry);
705 err = PTR_ERR(opaquedir);
706 if (IS_ERR(opaquedir))
707 goto out;
708 }
709
Al Viro59551022016-01-22 15:40:57 -0500710 inode_lock_nested(dir, I_MUTEX_PARENT);
Miklos Szeredi11f37102016-03-21 17:31:44 +0100711 upper = lookup_one_len(dentry->d_name.name, upperdir,
712 dentry->d_name.len);
713 err = PTR_ERR(upper);
714 if (IS_ERR(upper))
715 goto out_unlock;
716
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200717 err = -ESTALE;
Amir Goldsteind1595112016-10-26 12:34:06 +0300718 if ((opaquedir && upper != opaquedir) ||
719 (!opaquedir && upper != ovl_dentry_upper(dentry)))
720 goto out_dput_upper;
721
722 if (is_dir)
723 err = vfs_rmdir(dir, upper);
724 else
725 err = vfs_unlink(dir, upper, NULL);
726 ovl_dentry_version_inc(dentry->d_parent);
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200727
728 /*
729 * Keeping this dentry hashed would mean having to release
730 * upperpath/lowerpath, which could only be done if we are the
731 * sole user of this dentry. Too tricky... Just unhash for
732 * now.
733 */
Rui Wangce9113b2016-01-08 23:09:59 +0800734 if (!err)
735 d_drop(dentry);
Amir Goldsteind1595112016-10-26 12:34:06 +0300736out_dput_upper:
737 dput(upper);
Miklos Szeredi11f37102016-03-21 17:31:44 +0100738out_unlock:
Al Viro59551022016-01-22 15:40:57 -0500739 inode_unlock(dir);
Amir Goldsteind1595112016-10-26 12:34:06 +0300740 dput(opaquedir);
741out:
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200742 return err;
743}
744
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200745static int ovl_do_remove(struct dentry *dentry, bool is_dir)
746{
747 enum ovl_path_type type;
748 int err;
Vivek Goyal1175b6b2016-07-01 16:34:28 -0400749 const struct cred *old_cred;
750
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200751 err = ovl_want_write(dentry);
752 if (err)
753 goto out;
754
755 err = ovl_copy_up(dentry->d_parent);
756 if (err)
757 goto out_drop_write;
758
759 type = ovl_path_type(dentry);
Vivek Goyal1175b6b2016-07-01 16:34:28 -0400760
761 old_cred = ovl_override_creds(dentry->d_sb);
Miklos Szeredi2aff4532016-12-16 11:02:55 +0100762 if (!ovl_lower_positive(dentry))
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200763 err = ovl_remove_upper(dentry, is_dir);
Vivek Goyal1175b6b2016-07-01 16:34:28 -0400764 else
Miklos Szeredia105d682014-11-20 16:39:59 +0100765 err = ovl_remove_and_whiteout(dentry, is_dir);
Vivek Goyal1175b6b2016-07-01 16:34:28 -0400766 revert_creds(old_cred);
Miklos Szeredidbc816d2016-07-29 12:05:24 +0200767 if (!err) {
768 if (is_dir)
769 clear_nlink(dentry->d_inode);
770 else
771 drop_nlink(dentry->d_inode);
772 }
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200773out_drop_write:
774 ovl_drop_write(dentry);
775out:
776 return err;
777}
778
779static int ovl_unlink(struct inode *dir, struct dentry *dentry)
780{
781 return ovl_do_remove(dentry, false);
782}
783
784static int ovl_rmdir(struct inode *dir, struct dentry *dentry)
785{
786 return ovl_do_remove(dentry, true);
787}
788
Miklos Szeredi370e55a2016-12-16 11:02:55 +0100789static bool ovl_type_merge_or_lower(struct dentry *dentry)
790{
791 enum ovl_path_type type = ovl_path_type(dentry);
792
793 return OVL_TYPE_MERGE(type) || !OVL_TYPE_UPPER(type);
794}
795
Miklos Szeredia6c60652016-12-16 11:02:56 +0100796static bool ovl_can_move(struct dentry *dentry)
797{
798 return ovl_redirect_dir(dentry->d_sb) ||
799 !d_is_dir(dentry) || !ovl_type_merge_or_lower(dentry);
800}
801
Miklos Szeredia6c60652016-12-16 11:02:56 +0100802static char *ovl_get_redirect(struct dentry *dentry, bool samedir)
803{
804 char *buf, *ret;
805 struct dentry *d, *tmp;
Miklos Szeredi3ea22a72016-12-16 11:02:57 +0100806 int buflen = ovl_redirect_max + 1;
Miklos Szeredia6c60652016-12-16 11:02:56 +0100807
808 if (samedir) {
809 ret = kstrndup(dentry->d_name.name, dentry->d_name.len,
810 GFP_KERNEL);
811 goto out;
812 }
813
814 buf = ret = kmalloc(buflen, GFP_TEMPORARY);
815 if (!buf)
816 goto out;
817
818 buflen--;
819 buf[buflen] = '\0';
820 for (d = dget(dentry); !IS_ROOT(d);) {
821 const char *name;
822 int thislen;
823
824 spin_lock(&d->d_lock);
825 name = ovl_dentry_get_redirect(d);
826 if (name) {
827 thislen = strlen(name);
828 } else {
829 name = d->d_name.name;
830 thislen = d->d_name.len;
831 }
832
833 /* If path is too long, fall back to userspace move */
834 if (thislen + (name[0] != '/') > buflen) {
835 ret = ERR_PTR(-EXDEV);
836 spin_unlock(&d->d_lock);
837 goto out_put;
838 }
839
840 buflen -= thislen;
841 memcpy(&buf[buflen], name, thislen);
842 tmp = dget_dlock(d->d_parent);
843 spin_unlock(&d->d_lock);
844
845 dput(d);
846 d = tmp;
847
848 /* Absolute redirect: finished */
849 if (buf[buflen] == '/')
850 break;
851 buflen--;
852 buf[buflen] = '/';
853 }
854 ret = kstrdup(&buf[buflen], GFP_KERNEL);
855out_put:
856 dput(d);
857 kfree(buf);
858out:
859 return ret ? ret : ERR_PTR(-ENOMEM);
860}
861
862static int ovl_set_redirect(struct dentry *dentry, bool samedir)
863{
864 int err;
865 const char *redirect = ovl_dentry_get_redirect(dentry);
866
867 if (redirect && (samedir || redirect[0] == '/'))
868 return 0;
869
870 redirect = ovl_get_redirect(dentry, samedir);
871 if (IS_ERR(redirect))
872 return PTR_ERR(redirect);
873
874 err = ovl_do_setxattr(ovl_dentry_upper(dentry), OVL_XATTR_REDIRECT,
875 redirect, strlen(redirect), 0);
876 if (!err) {
877 spin_lock(&dentry->d_lock);
878 ovl_dentry_set_redirect(dentry, redirect);
879 spin_unlock(&dentry->d_lock);
880 } else {
881 kfree(redirect);
882 if (err == -EOPNOTSUPP)
883 ovl_clear_redirect_dir(dentry->d_sb);
884 else
885 pr_warn_ratelimited("overlay: failed to set redirect (%i)\n", err);
886 /* Fall back to userspace copy-up */
887 err = -EXDEV;
888 }
889 return err;
890}
891
Miklos Szeredi6c02cb52016-12-16 11:02:55 +0100892static int ovl_rename(struct inode *olddir, struct dentry *old,
893 struct inode *newdir, struct dentry *new,
894 unsigned int flags)
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200895{
896 int err;
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200897 struct dentry *old_upperdir;
898 struct dentry *new_upperdir;
899 struct dentry *olddentry;
900 struct dentry *newdentry;
901 struct dentry *trap;
902 bool old_opaque;
903 bool new_opaque;
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200904 bool cleanup_whiteout = false;
905 bool overwrite = !(flags & RENAME_EXCHANGE);
David Howellse36cb0b2015-01-29 12:02:35 +0000906 bool is_dir = d_is_dir(old);
Miklos Szeredi370e55a2016-12-16 11:02:55 +0100907 bool new_is_dir = d_is_dir(new);
Miklos Szeredia6c60652016-12-16 11:02:56 +0100908 bool samedir = olddir == newdir;
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200909 struct dentry *opaquedir = NULL;
910 const struct cred *old_cred = NULL;
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200911
912 err = -EINVAL;
913 if (flags & ~(RENAME_EXCHANGE | RENAME_NOREPLACE))
914 goto out;
915
916 flags &= ~RENAME_NOREPLACE;
917
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200918 /* Don't copy up directory trees */
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200919 err = -EXDEV;
Miklos Szeredia6c60652016-12-16 11:02:56 +0100920 if (!ovl_can_move(old))
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200921 goto out;
Miklos Szeredia6c60652016-12-16 11:02:56 +0100922 if (!overwrite && !ovl_can_move(new))
Miklos Szeredi370e55a2016-12-16 11:02:55 +0100923 goto out;
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200924
925 err = ovl_want_write(old);
926 if (err)
927 goto out;
928
929 err = ovl_copy_up(old);
930 if (err)
931 goto out_drop_write;
932
933 err = ovl_copy_up(new->d_parent);
934 if (err)
935 goto out_drop_write;
936 if (!overwrite) {
937 err = ovl_copy_up(new);
938 if (err)
939 goto out_drop_write;
940 }
941
Vivek Goyal1175b6b2016-07-01 16:34:28 -0400942 old_cred = ovl_override_creds(old->d_sb);
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200943
Miklos Szeredi370e55a2016-12-16 11:02:55 +0100944 if (overwrite && new_is_dir && ovl_type_merge_or_lower(new)) {
Miklos Szeredia105d682014-11-20 16:39:59 +0100945 opaquedir = ovl_check_empty_and_clear(new);
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200946 err = PTR_ERR(opaquedir);
947 if (IS_ERR(opaquedir)) {
948 opaquedir = NULL;
949 goto out_revert_creds;
950 }
951 }
952
953 if (overwrite) {
Miklos Szeredi2aff4532016-12-16 11:02:55 +0100954 if (ovl_lower_positive(old)) {
Miklos Szeredic412ce42016-12-16 11:02:55 +0100955 if (!ovl_dentry_is_whiteout(new)) {
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200956 /* Whiteout source */
957 flags |= RENAME_WHITEOUT;
958 } else {
959 /* Switch whiteouts */
960 flags |= RENAME_EXCHANGE;
961 }
Miklos Szeredic412ce42016-12-16 11:02:55 +0100962 } else if (is_dir && ovl_dentry_is_whiteout(new)) {
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200963 flags |= RENAME_EXCHANGE;
964 cleanup_whiteout = true;
965 }
966 }
967
968 old_upperdir = ovl_dentry_upper(old->d_parent);
969 new_upperdir = ovl_dentry_upper(new->d_parent);
970
971 trap = lock_rename(new_upperdir, old_upperdir);
972
Miklos Szeredi11f37102016-03-21 17:31:44 +0100973 olddentry = lookup_one_len(old->d_name.name, old_upperdir,
974 old->d_name.len);
975 err = PTR_ERR(olddentry);
976 if (IS_ERR(olddentry))
977 goto out_unlock;
978
979 err = -ESTALE;
980 if (olddentry != ovl_dentry_upper(old))
981 goto out_dput_old;
982
983 newdentry = lookup_one_len(new->d_name.name, new_upperdir,
984 new->d_name.len);
985 err = PTR_ERR(newdentry);
986 if (IS_ERR(newdentry))
987 goto out_dput_old;
988
Miklos Szeredi3ee23ff2016-12-16 11:02:55 +0100989 old_opaque = ovl_dentry_is_opaque(old);
990 new_opaque = ovl_dentry_is_opaque(new);
991
Miklos Szeredi11f37102016-03-21 17:31:44 +0100992 err = -ESTALE;
993 if (ovl_dentry_upper(new)) {
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200994 if (opaquedir) {
Miklos Szeredi11f37102016-03-21 17:31:44 +0100995 if (newdentry != opaquedir)
996 goto out_dput;
Miklos Szeredie9be9d52014-10-24 00:14:38 +0200997 } else {
Miklos Szeredi11f37102016-03-21 17:31:44 +0100998 if (newdentry != ovl_dentry_upper(new))
999 goto out_dput;
Miklos Szeredie9be9d52014-10-24 00:14:38 +02001000 }
1001 } else {
Miklos Szeredi11f37102016-03-21 17:31:44 +01001002 if (!d_is_negative(newdentry) &&
1003 (!new_opaque || !ovl_is_whiteout(newdentry)))
1004 goto out_dput;
Miklos Szeredie9be9d52014-10-24 00:14:38 +02001005 }
1006
Miklos Szeredie9be9d52014-10-24 00:14:38 +02001007 if (olddentry == trap)
1008 goto out_dput;
1009 if (newdentry == trap)
1010 goto out_dput;
1011
Miklos Szeredi804032f2016-12-16 11:02:55 +01001012 if (WARN_ON(olddentry->d_inode == newdentry->d_inode))
1013 goto out_dput;
1014
Miklos Szeredi5cf5b472016-12-16 11:02:57 +01001015 err = 0;
Miklos Szeredia6c60652016-12-16 11:02:56 +01001016 if (is_dir) {
Miklos Szeredi5cf5b472016-12-16 11:02:57 +01001017 if (ovl_type_merge_or_lower(old))
Miklos Szeredia6c60652016-12-16 11:02:56 +01001018 err = ovl_set_redirect(old, samedir);
Amir Goldstein97c684c2016-11-21 18:57:34 +02001019 else if (!old_opaque && ovl_type_merge(new->d_parent))
Miklos Szeredi5cf5b472016-12-16 11:02:57 +01001020 err = ovl_set_opaque(old, olddentry);
1021 if (err)
1022 goto out_dput;
Miklos Szeredie9be9d52014-10-24 00:14:38 +02001023 }
Miklos Szeredia6c60652016-12-16 11:02:56 +01001024 if (!overwrite && new_is_dir) {
Miklos Szeredi5cf5b472016-12-16 11:02:57 +01001025 if (ovl_type_merge_or_lower(new))
Miklos Szeredia6c60652016-12-16 11:02:56 +01001026 err = ovl_set_redirect(new, samedir);
Amir Goldstein97c684c2016-11-21 18:57:34 +02001027 else if (!new_opaque && ovl_type_merge(old->d_parent))
Miklos Szeredi5cf5b472016-12-16 11:02:57 +01001028 err = ovl_set_opaque(new, newdentry);
1029 if (err)
1030 goto out_dput;
Miklos Szeredie9be9d52014-10-24 00:14:38 +02001031 }
1032
Miklos Szeredi3ee23ff2016-12-16 11:02:55 +01001033 err = ovl_do_rename(old_upperdir->d_inode, olddentry,
1034 new_upperdir->d_inode, newdentry, flags);
1035 if (err)
Miklos Szeredie9be9d52014-10-24 00:14:38 +02001036 goto out_dput;
Miklos Szeredie9be9d52014-10-24 00:14:38 +02001037
1038 if (cleanup_whiteout)
1039 ovl_cleanup(old_upperdir->d_inode, newdentry);
1040
1041 ovl_dentry_version_inc(old->d_parent);
1042 ovl_dentry_version_inc(new->d_parent);
1043
1044out_dput:
1045 dput(newdentry);
Miklos Szeredi11f37102016-03-21 17:31:44 +01001046out_dput_old:
1047 dput(olddentry);
Miklos Szeredie9be9d52014-10-24 00:14:38 +02001048out_unlock:
1049 unlock_rename(new_upperdir, old_upperdir);
1050out_revert_creds:
Vivek Goyal1175b6b2016-07-01 16:34:28 -04001051 revert_creds(old_cred);
Miklos Szeredie9be9d52014-10-24 00:14:38 +02001052out_drop_write:
1053 ovl_drop_write(old);
1054out:
1055 dput(opaquedir);
1056 return err;
1057}
1058
1059const struct inode_operations ovl_dir_inode_operations = {
1060 .lookup = ovl_lookup,
1061 .mkdir = ovl_mkdir,
1062 .symlink = ovl_symlink,
1063 .unlink = ovl_unlink,
1064 .rmdir = ovl_rmdir,
Miklos Szeredi6c02cb52016-12-16 11:02:55 +01001065 .rename = ovl_rename,
Miklos Szeredie9be9d52014-10-24 00:14:38 +02001066 .link = ovl_link,
1067 .setattr = ovl_setattr,
1068 .create = ovl_create,
1069 .mknod = ovl_mknod,
1070 .permission = ovl_permission,
1071 .getattr = ovl_dir_getattr,
Miklos Szeredie9be9d52014-10-24 00:14:38 +02001072 .listxattr = ovl_listxattr,
Vivek Goyal39a25b22016-07-01 16:34:26 -04001073 .get_acl = ovl_get_acl,
Miklos Szeredid719e8f2016-07-29 12:05:23 +02001074 .update_time = ovl_update_time,
Miklos Szeredie9be9d52014-10-24 00:14:38 +02001075};