Skip to content

Commit f25801e

Browse files
dhowellsAl Viro
authored andcommitted
overlay: Call ovl_drop_write() earlier in ovl_dentry_open()
Call ovl_drop_write() earlier in ovl_dentry_open() before we call vfs_open() as we've done the copy up for which we needed the freeze-write lock by that point. Signed-off-by: David Howells <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent 4ef51e8 commit f25801e

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

fs/overlayfs/inode.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -343,31 +343,25 @@ static int ovl_dentry_open(struct dentry *dentry, struct file *file,
343343
int err;
344344
struct path realpath;
345345
enum ovl_path_type type;
346-
bool want_write = false;
347346

348347
type = ovl_path_real(dentry, &realpath);
349348
if (ovl_open_need_copy_up(file->f_flags, type, realpath.dentry)) {
350-
want_write = true;
351349
err = ovl_want_write(dentry);
352350
if (err)
353-
goto out;
351+
return err;
354352

355353
if (file->f_flags & O_TRUNC)
356354
err = ovl_copy_up_last(dentry, NULL, true);
357355
else
358356
err = ovl_copy_up(dentry);
357+
ovl_drop_write(dentry);
359358
if (err)
360-
goto out_drop_write;
359+
return err;
361360

362361
ovl_path_upper(dentry, &realpath);
363362
}
364363

365-
err = vfs_open(&realpath, file, cred);
366-
out_drop_write:
367-
if (want_write)
368-
ovl_drop_write(dentry);
369-
out:
370-
return err;
364+
return vfs_open(&realpath, file, cred);
371365
}
372366

373367
static const struct inode_operations ovl_file_inode_operations = {

0 commit comments

Comments
 (0)