blob: beec63b107f47d9d74c67b89297473d43f72f4ae [file] [log] [blame]
Daniel Campello35c9e242015-07-20 16:23:50 -07001/*
2 * fs/sdcardfs/lookup.c
3 *
4 * Copyright (c) 2013 Samsung Electronics Co. Ltd
5 * Authors: Daeho Jeong, Woojoong Lee, Seunghwan Hyun,
6 * Sunghwan Yun, Sungjong Seo
7 *
8 * This program has been developed as a stackable file system based on
9 * the WrapFS which written by
10 *
11 * Copyright (c) 1998-2011 Erez Zadok
12 * Copyright (c) 2009 Shrikar Archak
13 * Copyright (c) 2003-2011 Stony Brook University
14 * Copyright (c) 2003-2011 The Research Foundation of SUNY
15 *
16 * This file is dual licensed. It may be redistributed and/or modified
17 * under the terms of the Apache 2.0 License OR version 2 of the GNU
18 * General Public License.
19 */
20
21#include "sdcardfs.h"
22#include "linux/delay.h"
23
24/* The dentry cache is just so we have properly sized dentries */
25static struct kmem_cache *sdcardfs_dentry_cachep;
26
27int sdcardfs_init_dentry_cache(void)
28{
29 sdcardfs_dentry_cachep =
30 kmem_cache_create("sdcardfs_dentry",
31 sizeof(struct sdcardfs_dentry_info),
32 0, SLAB_RECLAIM_ACCOUNT, NULL);
33
34 return sdcardfs_dentry_cachep ? 0 : -ENOMEM;
35}
36
37void sdcardfs_destroy_dentry_cache(void)
38{
Daniel Rosenbergb6704a82017-03-21 16:29:13 -070039 kmem_cache_destroy(sdcardfs_dentry_cachep);
Daniel Campello35c9e242015-07-20 16:23:50 -070040}
41
42void free_dentry_private_data(struct dentry *dentry)
43{
Daniel Campello35c9e242015-07-20 16:23:50 -070044 kmem_cache_free(sdcardfs_dentry_cachep, dentry->d_fsdata);
45 dentry->d_fsdata = NULL;
46}
47
48/* allocate new dentry private data */
49int new_dentry_private_data(struct dentry *dentry)
50{
51 struct sdcardfs_dentry_info *info = SDCARDFS_D(dentry);
52
53 /* use zalloc to init dentry_info.lower_path */
54 info = kmem_cache_zalloc(sdcardfs_dentry_cachep, GFP_ATOMIC);
55 if (!info)
56 return -ENOMEM;
57
58 spin_lock_init(&info->lock);
59 dentry->d_fsdata = info;
60
61 return 0;
62}
63
Daniel Rosenberg497ac902016-02-03 21:08:21 -080064struct inode_data {
65 struct inode *lower_inode;
66 userid_t id;
67};
68
69static int sdcardfs_inode_test(struct inode *inode, void *candidate_data/*void *candidate_lower_inode*/)
Daniel Campello35c9e242015-07-20 16:23:50 -070070{
71 struct inode *current_lower_inode = sdcardfs_lower_inode(inode);
Daniel Rosenberga56a1052017-05-15 14:03:15 -070072 userid_t current_userid = SDCARDFS_I(inode)->data->userid;
Daniel Rosenberg5e024f62017-03-16 17:42:58 -070073
Daniel Rosenberg497ac902016-02-03 21:08:21 -080074 if (current_lower_inode == ((struct inode_data *)candidate_data)->lower_inode &&
75 current_userid == ((struct inode_data *)candidate_data)->id)
Daniel Campello35c9e242015-07-20 16:23:50 -070076 return 1; /* found a match */
77 else
78 return 0; /* no match */
79}
80
81static int sdcardfs_inode_set(struct inode *inode, void *lower_inode)
82{
83 /* we do actual inode initialization in sdcardfs_iget */
84 return 0;
85}
86
Daniel Rosenberg497ac902016-02-03 21:08:21 -080087struct inode *sdcardfs_iget(struct super_block *sb, struct inode *lower_inode, userid_t id)
Daniel Campello35c9e242015-07-20 16:23:50 -070088{
89 struct sdcardfs_inode_info *info;
Daniel Rosenberg497ac902016-02-03 21:08:21 -080090 struct inode_data data;
Daniel Campello35c9e242015-07-20 16:23:50 -070091 struct inode *inode; /* the new inode to return */
Daniel Rosenberg480cd3e2017-04-18 12:45:48 -070092
93 if (!igrab(lower_inode))
94 return ERR_PTR(-ESTALE);
Daniel Campello35c9e242015-07-20 16:23:50 -070095
Daniel Rosenberg497ac902016-02-03 21:08:21 -080096 data.id = id;
97 data.lower_inode = lower_inode;
Daniel Campello35c9e242015-07-20 16:23:50 -070098 inode = iget5_locked(sb, /* our superblock */
99 /*
100 * hashval: we use inode number, but we can
101 * also use "(unsigned long)lower_inode"
102 * instead.
103 */
104 lower_inode->i_ino, /* hashval */
Daniel Rosenberg5e024f62017-03-16 17:42:58 -0700105 sdcardfs_inode_test, /* inode comparison function */
Daniel Campello35c9e242015-07-20 16:23:50 -0700106 sdcardfs_inode_set, /* inode init function */
Daniel Rosenberg497ac902016-02-03 21:08:21 -0800107 &data); /* data passed to test+set fxns */
Daniel Campello35c9e242015-07-20 16:23:50 -0700108 if (!inode) {
Daniel Campello35c9e242015-07-20 16:23:50 -0700109 iput(lower_inode);
Daniel Rosenberg480cd3e2017-04-18 12:45:48 -0700110 return ERR_PTR(-ENOMEM);
Daniel Campello35c9e242015-07-20 16:23:50 -0700111 }
Daniel Rosenberg480cd3e2017-04-18 12:45:48 -0700112 /* if found a cached inode, then just return it (after iput) */
113 if (!(inode->i_state & I_NEW)) {
114 iput(lower_inode);
Daniel Campello35c9e242015-07-20 16:23:50 -0700115 return inode;
Daniel Rosenberg480cd3e2017-04-18 12:45:48 -0700116 }
Daniel Campello35c9e242015-07-20 16:23:50 -0700117
118 /* initialize new inode */
119 info = SDCARDFS_I(inode);
120
121 inode->i_ino = lower_inode->i_ino;
Daniel Campello35c9e242015-07-20 16:23:50 -0700122 sdcardfs_set_lower_inode(inode, lower_inode);
123
124 inode->i_version++;
125
126 /* use different set of inode ops for symlinks & directories */
127 if (S_ISDIR(lower_inode->i_mode))
128 inode->i_op = &sdcardfs_dir_iops;
129 else if (S_ISLNK(lower_inode->i_mode))
130 inode->i_op = &sdcardfs_symlink_iops;
131 else
132 inode->i_op = &sdcardfs_main_iops;
133
134 /* use different set of file ops for directories */
135 if (S_ISDIR(lower_inode->i_mode))
136 inode->i_fop = &sdcardfs_dir_fops;
137 else
138 inode->i_fop = &sdcardfs_main_fops;
139
140 inode->i_mapping->a_ops = &sdcardfs_aops;
141
142 inode->i_atime.tv_sec = 0;
143 inode->i_atime.tv_nsec = 0;
144 inode->i_mtime.tv_sec = 0;
145 inode->i_mtime.tv_nsec = 0;
146 inode->i_ctime.tv_sec = 0;
147 inode->i_ctime.tv_nsec = 0;
148
149 /* properly initialize special inodes */
150 if (S_ISBLK(lower_inode->i_mode) || S_ISCHR(lower_inode->i_mode) ||
151 S_ISFIFO(lower_inode->i_mode) || S_ISSOCK(lower_inode->i_mode))
152 init_special_inode(inode, lower_inode->i_mode,
153 lower_inode->i_rdev);
154
155 /* all well, copy inode attributes */
Daniel Rosenberg497ac902016-02-03 21:08:21 -0800156 sdcardfs_copy_and_fix_attrs(inode, lower_inode);
Daniel Campello35c9e242015-07-20 16:23:50 -0700157 fsstack_copy_inode_size(inode, lower_inode);
158
Daniel Campello35c9e242015-07-20 16:23:50 -0700159 unlock_new_inode(inode);
160 return inode;
161}
162
163/*
Daniel Rosenbergd0497fe2017-03-09 22:11:08 -0800164 * Helper interpose routine, called directly by ->lookup to handle
165 * spliced dentries.
Daniel Campello35c9e242015-07-20 16:23:50 -0700166 */
Daniel Rosenbergd0497fe2017-03-09 22:11:08 -0800167static struct dentry *__sdcardfs_interpose(struct dentry *dentry,
168 struct super_block *sb,
169 struct path *lower_path,
170 userid_t id)
Daniel Campello35c9e242015-07-20 16:23:50 -0700171{
Daniel Campello35c9e242015-07-20 16:23:50 -0700172 struct inode *inode;
173 struct inode *lower_inode;
174 struct super_block *lower_sb;
Daniel Rosenbergd0497fe2017-03-09 22:11:08 -0800175 struct dentry *ret_dentry;
Daniel Campello35c9e242015-07-20 16:23:50 -0700176
Daniel Rosenberg63d20762016-12-01 14:36:29 -0800177 lower_inode = d_inode(lower_path->dentry);
Daniel Campello35c9e242015-07-20 16:23:50 -0700178 lower_sb = sdcardfs_lower_super(sb);
179
180 /* check that the lower file system didn't cross a mount point */
181 if (lower_inode->i_sb != lower_sb) {
Daniel Rosenbergd0497fe2017-03-09 22:11:08 -0800182 ret_dentry = ERR_PTR(-EXDEV);
Daniel Campello35c9e242015-07-20 16:23:50 -0700183 goto out;
184 }
185
186 /*
187 * We allocate our new inode below by calling sdcardfs_iget,
188 * which will initialize some of the new inode's fields
189 */
190
191 /* inherit lower inode number for sdcardfs's inode */
Daniel Rosenberg497ac902016-02-03 21:08:21 -0800192 inode = sdcardfs_iget(sb, lower_inode, id);
Daniel Campello35c9e242015-07-20 16:23:50 -0700193 if (IS_ERR(inode)) {
Daniel Rosenbergd0497fe2017-03-09 22:11:08 -0800194 ret_dentry = ERR_CAST(inode);
Daniel Campello35c9e242015-07-20 16:23:50 -0700195 goto out;
196 }
197
Daniel Rosenbergd0497fe2017-03-09 22:11:08 -0800198 ret_dentry = d_splice_alias(inode, dentry);
199 dentry = ret_dentry ?: dentry;
Daniel Rosenberg3d7ac4f2017-06-07 12:44:50 -0700200 if (!IS_ERR(dentry))
201 update_derived_permission_lock(dentry);
Daniel Campello35c9e242015-07-20 16:23:50 -0700202out:
Daniel Rosenbergd0497fe2017-03-09 22:11:08 -0800203 return ret_dentry;
204}
205
206/*
207 * Connect an sdcardfs inode dentry/inode with several lower ones. This is
208 * the classic stackable file system "vnode interposition" action.
209 *
210 * @dentry: sdcardfs's dentry which interposes on lower one
211 * @sb: sdcardfs's super_block
212 * @lower_path: the lower path (caller does path_get/put)
213 */
214int sdcardfs_interpose(struct dentry *dentry, struct super_block *sb,
215 struct path *lower_path, userid_t id)
216{
217 struct dentry *ret_dentry;
218
219 ret_dentry = __sdcardfs_interpose(dentry, sb, lower_path, id);
220 return PTR_ERR(ret_dentry);
Daniel Campello35c9e242015-07-20 16:23:50 -0700221}
222
Daniel Rosenbergfe0756d2017-03-01 17:04:41 -0800223struct sdcardfs_name_data {
224 struct dir_context ctx;
225 const struct qstr *to_find;
226 char *name;
227 bool found;
228};
229
Daniel Rosenberg5e024f62017-03-16 17:42:58 -0700230static int sdcardfs_name_match(struct dir_context *ctx, const char *name,
231 int namelen, loff_t offset, u64 ino, unsigned int d_type)
Daniel Rosenbergfe0756d2017-03-01 17:04:41 -0800232{
233 struct sdcardfs_name_data *buf = container_of(ctx, struct sdcardfs_name_data, ctx);
234 struct qstr candidate = QSTR_INIT(name, namelen);
235
236 if (qstr_case_eq(buf->to_find, &candidate)) {
237 memcpy(buf->name, name, namelen);
238 buf->name[namelen] = 0;
239 buf->found = true;
240 return 1;
241 }
242 return 0;
243}
244
Daniel Campello35c9e242015-07-20 16:23:50 -0700245/*
246 * Main driver function for sdcardfs's lookup.
247 *
248 * Returns: NULL (ok), ERR_PTR if an error occurred.
249 * Fills in lower_parent_path with <dentry,mnt> on success.
250 */
251static struct dentry *__sdcardfs_lookup(struct dentry *dentry,
Daniel Rosenberg497ac902016-02-03 21:08:21 -0800252 unsigned int flags, struct path *lower_parent_path, userid_t id)
Daniel Campello35c9e242015-07-20 16:23:50 -0700253{
254 int err = 0;
255 struct vfsmount *lower_dir_mnt;
256 struct dentry *lower_dir_dentry = NULL;
257 struct dentry *lower_dentry;
Daniel Rosenberg5004c5f2017-01-31 20:07:51 -0800258 const struct qstr *name;
Daniel Campello35c9e242015-07-20 16:23:50 -0700259 struct path lower_path;
Daniel Rosenberg8e818ff2017-02-14 20:47:17 -0800260 struct qstr dname;
Daniel Rosenbergd0497fe2017-03-09 22:11:08 -0800261 struct dentry *ret_dentry = NULL;
Daniel Campello35c9e242015-07-20 16:23:50 -0700262 struct sdcardfs_sb_info *sbi;
263
264 sbi = SDCARDFS_SB(dentry->d_sb);
265 /* must initialize dentry operations */
266 d_set_d_op(dentry, &sdcardfs_ci_dops);
267
268 if (IS_ROOT(dentry))
269 goto out;
270
Daniel Rosenberg5004c5f2017-01-31 20:07:51 -0800271 name = &dentry->d_name;
Daniel Campello35c9e242015-07-20 16:23:50 -0700272
273 /* now start the actual lookup procedure */
274 lower_dir_dentry = lower_parent_path->dentry;
275 lower_dir_mnt = lower_parent_path->mnt;
276
277 /* Use vfs_path_lookup to check if the dentry exists or not */
Daniel Rosenberg5004c5f2017-01-31 20:07:51 -0800278 err = vfs_path_lookup(lower_dir_dentry, lower_dir_mnt, name->name, 0,
Daniel Campellod1d080c2015-07-20 16:27:37 -0700279 &lower_path);
Daniel Rosenberg7c4dcd22016-04-27 15:31:29 -0700280 /* check for other cases */
281 if (err == -ENOENT) {
Daniel Rosenbergfe0756d2017-03-01 17:04:41 -0800282 struct file *file;
283 const struct cred *cred = current_cred();
284
285 struct sdcardfs_name_data buffer = {
286 .ctx.actor = sdcardfs_name_match,
287 .to_find = name,
288 .name = __getname(),
289 .found = false,
290 };
291
292 if (!buffer.name) {
293 err = -ENOMEM;
294 goto out;
Daniel Rosenberg7c4dcd22016-04-27 15:31:29 -0700295 }
Daniel Rosenbergfe0756d2017-03-01 17:04:41 -0800296 file = dentry_open(lower_parent_path, O_RDONLY, cred);
297 if (IS_ERR(file)) {
298 err = PTR_ERR(file);
299 goto put_name;
300 }
301 err = iterate_dir(file, &buffer.ctx);
302 fput(file);
303 if (err)
304 goto put_name;
305
306 if (buffer.found)
Daniel Rosenberg7c4dcd22016-04-27 15:31:29 -0700307 err = vfs_path_lookup(lower_dir_dentry,
308 lower_dir_mnt,
Daniel Rosenbergfe0756d2017-03-01 17:04:41 -0800309 buffer.name, 0,
Daniel Rosenberg7c4dcd22016-04-27 15:31:29 -0700310 &lower_path);
Daniel Rosenbergfe0756d2017-03-01 17:04:41 -0800311 else
312 err = -ENOENT;
313put_name:
314 __putname(buffer.name);
Daniel Rosenberg7c4dcd22016-04-27 15:31:29 -0700315 }
Daniel Campello35c9e242015-07-20 16:23:50 -0700316
317 /* no error: handle positive dentries */
318 if (!err) {
319 /* check if the dentry is an obb dentry
320 * if true, the lower_inode must be replaced with
Daniel Rosenberg5e024f62017-03-16 17:42:58 -0700321 * the inode of the graft path
322 */
Daniel Campello35c9e242015-07-20 16:23:50 -0700323
Daniel Rosenberg5e024f62017-03-16 17:42:58 -0700324 if (need_graft_path(dentry)) {
Daniel Campello35c9e242015-07-20 16:23:50 -0700325
326 /* setup_obb_dentry()
Daniel Rosenberg5e024f62017-03-16 17:42:58 -0700327 * The lower_path will be stored to the dentry's orig_path
Daniel Campello35c9e242015-07-20 16:23:50 -0700328 * and the base obbpath will be copyed to the lower_path variable.
329 * if an error returned, there's no change in the lower_path
Daniel Rosenberg5e024f62017-03-16 17:42:58 -0700330 * returns: -ERRNO if error (0: no error)
331 */
Daniel Campellod1d080c2015-07-20 16:27:37 -0700332 err = setup_obb_dentry(dentry, &lower_path);
Daniel Campello35c9e242015-07-20 16:23:50 -0700333
Daniel Rosenberg5e024f62017-03-16 17:42:58 -0700334 if (err) {
Daniel Campello35c9e242015-07-20 16:23:50 -0700335 /* if the sbi->obbpath is not available, we can optionally
336 * setup the lower_path with its orig_path.
337 * but, the current implementation just returns an error
338 * because the sdcard daemon also regards this case as
Daniel Rosenberg5e024f62017-03-16 17:42:58 -0700339 * a lookup fail.
340 */
Daniel Rosenberg77ecf212017-03-16 17:46:13 -0700341 pr_info("sdcardfs: base obbpath is not available\n");
Daniel Campello35c9e242015-07-20 16:23:50 -0700342 sdcardfs_put_reset_orig_path(dentry);
343 goto out;
344 }
345 }
346
Daniel Campellod1d080c2015-07-20 16:27:37 -0700347 sdcardfs_set_lower_path(dentry, &lower_path);
Daniel Rosenbergd0497fe2017-03-09 22:11:08 -0800348 ret_dentry =
349 __sdcardfs_interpose(dentry, dentry->d_sb, &lower_path, id);
350 if (IS_ERR(ret_dentry)) {
351 err = PTR_ERR(ret_dentry);
352 /* path_put underlying path on error */
Daniel Campello35c9e242015-07-20 16:23:50 -0700353 sdcardfs_put_reset_lower_path(dentry);
Daniel Rosenbergd0497fe2017-03-09 22:11:08 -0800354 }
Daniel Campello35c9e242015-07-20 16:23:50 -0700355 goto out;
356 }
357
358 /*
359 * We don't consider ENOENT an error, and we want to return a
360 * negative dentry.
361 */
362 if (err && err != -ENOENT)
363 goto out;
364
365 /* instatiate a new negative dentry */
Daniel Rosenberg8e818ff2017-02-14 20:47:17 -0800366 dname.name = name->name;
367 dname.len = name->len;
Daniel Rosenbergcac7ba92017-04-20 18:05:02 -0700368
369 /* See if the low-level filesystem might want
370 * to use its own hash
371 */
372 lower_dentry = d_hash_and_lookup(lower_dir_dentry, &dname);
373 if (IS_ERR(lower_dentry))
374 return lower_dentry;
Daniel Campello35c9e242015-07-20 16:23:50 -0700375 if (!lower_dentry) {
Daniel Rosenberg57968702017-04-20 18:21:50 -0700376 /* We called vfs_path_lookup earlier, and did not get a negative
377 * dentry then. Don't confuse the lower filesystem by forcing
378 * one on it now...
379 */
380 err = -ENOENT;
Daniel Campello35c9e242015-07-20 16:23:50 -0700381 goto out;
382 }
Daniel Campello35c9e242015-07-20 16:23:50 -0700383
Daniel Campello35c9e242015-07-20 16:23:50 -0700384 lower_path.dentry = lower_dentry;
385 lower_path.mnt = mntget(lower_dir_mnt);
386 sdcardfs_set_lower_path(dentry, &lower_path);
387
388 /*
389 * If the intent is to create a file, then don't return an error, so
390 * the VFS will continue the process of making this negative dentry
391 * into a positive one.
392 */
Daniel Campellod1d080c2015-07-20 16:27:37 -0700393 if (flags & (LOOKUP_CREATE|LOOKUP_RENAME_TARGET))
Daniel Campello35c9e242015-07-20 16:23:50 -0700394 err = 0;
395
396out:
Daniel Rosenbergd0497fe2017-03-09 22:11:08 -0800397 if (err)
398 return ERR_PTR(err);
399 return ret_dentry;
Daniel Campello35c9e242015-07-20 16:23:50 -0700400}
401
402/*
403 * On success:
Daniel Rosenberg5e024f62017-03-16 17:42:58 -0700404 * fills dentry object appropriate values and returns NULL.
Daniel Campello35c9e242015-07-20 16:23:50 -0700405 * On fail (== error)
Daniel Rosenberg5e024f62017-03-16 17:42:58 -0700406 * returns error ptr
Daniel Campello35c9e242015-07-20 16:23:50 -0700407 *
Amit Pundirb47e1102016-06-01 21:53:20 +0530408 * @dir : Parent inode.
Daniel Campello35c9e242015-07-20 16:23:50 -0700409 * @dentry : Target dentry to lookup. we should set each of fields.
410 * (dentry->d_name is initialized already)
411 * @nd : nameidata of parent inode
412 */
413struct dentry *sdcardfs_lookup(struct inode *dir, struct dentry *dentry,
Daniel Campellod1d080c2015-07-20 16:27:37 -0700414 unsigned int flags)
Daniel Campello35c9e242015-07-20 16:23:50 -0700415{
416 struct dentry *ret = NULL, *parent;
417 struct path lower_parent_path;
418 int err = 0;
Daniel Campello35c9e242015-07-20 16:23:50 -0700419 const struct cred *saved_cred = NULL;
420
421 parent = dget_parent(dentry);
422
Daniel Rosenberg5004c5f2017-01-31 20:07:51 -0800423 if (!check_caller_access_to_name(d_inode(parent), &dentry->d_name)) {
Daniel Campello35c9e242015-07-20 16:23:50 -0700424 ret = ERR_PTR(-EACCES);
Daniel Campello35c9e242015-07-20 16:23:50 -0700425 goto out_err;
Daniel Rosenberg5e024f62017-03-16 17:42:58 -0700426 }
Daniel Campello35c9e242015-07-20 16:23:50 -0700427
428 /* save current_cred and override it */
Daniel Rosenberg8a359812018-07-19 18:08:35 -0700429 saved_cred = override_fsids(SDCARDFS_SB(dir->i_sb),
430 SDCARDFS_I(dir)->data);
431 if (!saved_cred) {
432 ret = ERR_PTR(-ENOMEM);
433 goto out_err;
434 }
Daniel Campello35c9e242015-07-20 16:23:50 -0700435
436 sdcardfs_get_lower_path(parent, &lower_parent_path);
437
438 /* allocate dentry private data. We free it in ->d_release */
439 err = new_dentry_private_data(dentry);
440 if (err) {
441 ret = ERR_PTR(err);
442 goto out;
443 }
444
Daniel Rosenberga56a1052017-05-15 14:03:15 -0700445 ret = __sdcardfs_lookup(dentry, flags, &lower_parent_path,
446 SDCARDFS_I(dir)->data->userid);
Daniel Campello35c9e242015-07-20 16:23:50 -0700447 if (IS_ERR(ret))
Daniel Campello35c9e242015-07-20 16:23:50 -0700448 goto out;
Daniel Campello35c9e242015-07-20 16:23:50 -0700449 if (ret)
450 dentry = ret;
Daniel Rosenberg63d20762016-12-01 14:36:29 -0800451 if (d_inode(dentry)) {
452 fsstack_copy_attr_times(d_inode(dentry),
453 sdcardfs_lower_inode(d_inode(dentry)));
Daniel Rosenbergcb1b9452016-08-16 15:19:26 -0700454 /* get derived permission */
Daniel Campello35c9e242015-07-20 16:23:50 -0700455 get_derived_permission(parent, dentry);
Daniel Rosenberg90219272016-10-26 20:27:20 -0700456 fixup_tmp_permissions(d_inode(dentry));
Daniel Rosenbergad905252017-01-25 13:48:45 -0800457 fixup_lower_ownership(dentry, dentry->d_name.name);
Daniel Campello35c9e242015-07-20 16:23:50 -0700458 }
459 /* update parent directory's atime */
Daniel Rosenberg63d20762016-12-01 14:36:29 -0800460 fsstack_copy_attr_atime(d_inode(parent),
461 sdcardfs_lower_inode(d_inode(parent)));
Daniel Campello35c9e242015-07-20 16:23:50 -0700462
463out:
464 sdcardfs_put_lower_path(parent, &lower_parent_path);
Daniel Rosenberg8a359812018-07-19 18:08:35 -0700465 revert_fsids(saved_cred);
Daniel Campello35c9e242015-07-20 16:23:50 -0700466out_err:
467 dput(parent);
468 return ret;
469}