diff options
author | Miklos Szeredi <mszeredi@redhat.com> | 2018-07-18 09:44:43 -0400 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2018-07-18 09:44:43 -0400 |
commit | 8cf9ee5061037accf61775f438ad7513576d4413 (patch) | |
tree | 6301abb5e6b1386103ea6c0dff437afd5f6ae6a8 /fs | |
parent | 4ab30319fd7c691a1b3165325c647a5cd6d282ac (diff) |
Revert "vfs: do get_write_access() on upper layer of overlayfs"
This reverts commit 4d0c5ba2ff79ef9f5188998b29fd28fcb05f3667.
We now get write access on both overlay and underlying layers so this patch
is no longer needed for correct operation.
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/locks.c | 3 | ||||
-rw-r--r-- | fs/open.c | 15 |
2 files changed, 3 insertions, 15 deletions
diff --git a/fs/locks.c b/fs/locks.c index db7b6917d9c5..baa564841c03 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
@@ -1654,8 +1654,7 @@ check_conflicting_open(const struct dentry *dentry, const long arg, int flags) | |||
1654 | if (flags & FL_LAYOUT) | 1654 | if (flags & FL_LAYOUT) |
1655 | return 0; | 1655 | return 0; |
1656 | 1656 | ||
1657 | if ((arg == F_RDLCK) && | 1657 | if ((arg == F_RDLCK) && (atomic_read(&inode->i_writecount) > 0)) |
1658 | (atomic_read(&d_real_inode(dentry)->i_writecount) > 0)) | ||
1659 | return -EAGAIN; | 1658 | return -EAGAIN; |
1660 | 1659 | ||
1661 | if ((arg == F_WRLCK) && ((d_count(dentry) > 1) || | 1660 | if ((arg == F_WRLCK) && ((d_count(dentry) > 1) || |
@@ -68,7 +68,6 @@ int do_truncate(struct dentry *dentry, loff_t length, unsigned int time_attrs, | |||
68 | long vfs_truncate(const struct path *path, loff_t length) | 68 | long vfs_truncate(const struct path *path, loff_t length) |
69 | { | 69 | { |
70 | struct inode *inode; | 70 | struct inode *inode; |
71 | struct dentry *upperdentry; | ||
72 | long error; | 71 | long error; |
73 | 72 | ||
74 | inode = path->dentry->d_inode; | 73 | inode = path->dentry->d_inode; |
@@ -91,17 +90,7 @@ long vfs_truncate(const struct path *path, loff_t length) | |||
91 | if (IS_APPEND(inode)) | 90 | if (IS_APPEND(inode)) |
92 | goto mnt_drop_write_and_out; | 91 | goto mnt_drop_write_and_out; |
93 | 92 | ||
94 | /* | 93 | error = get_write_access(inode); |
95 | * If this is an overlayfs then do as if opening the file so we get | ||
96 | * write access on the upper inode, not on the overlay inode. For | ||
97 | * non-overlay filesystems d_real() is an identity function. | ||
98 | */ | ||
99 | upperdentry = d_real(path->dentry, NULL, O_WRONLY); | ||
100 | error = PTR_ERR(upperdentry); | ||
101 | if (IS_ERR(upperdentry)) | ||
102 | goto mnt_drop_write_and_out; | ||
103 | |||
104 | error = get_write_access(upperdentry->d_inode); | ||
105 | if (error) | 94 | if (error) |
106 | goto mnt_drop_write_and_out; | 95 | goto mnt_drop_write_and_out; |
107 | 96 | ||
@@ -120,7 +109,7 @@ long vfs_truncate(const struct path *path, loff_t length) | |||
120 | error = do_truncate(path->dentry, length, 0, NULL); | 109 | error = do_truncate(path->dentry, length, 0, NULL); |
121 | 110 | ||
122 | put_write_and_out: | 111 | put_write_and_out: |
123 | put_write_access(upperdentry->d_inode); | 112 | put_write_access(inode); |
124 | mnt_drop_write_and_out: | 113 | mnt_drop_write_and_out: |
125 | mnt_drop_write(path->mnt); | 114 | mnt_drop_write(path->mnt); |
126 | out: | 115 | out: |