Commit ea0341e071527d5cec350917b01ab901af09d758
1 parent
e3c4269d13
Exists in
smarc-imx_3.14.28_1.0.0_ga
and in
1 other branch
GFS2: Fix ref count bug relating to atomic_open
In the case that atomic_open calls finish_no_open() with the dentry that was supplied to gfs2_atomic_open() an extra reference count is required. This patch fixes that issue preventing a bug trap triggering at umount time. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Showing 1 changed file with 4 additions and 1 deletions Side-by-side Diff
fs/gfs2/inode.c
... | ... | @@ -1171,8 +1171,11 @@ |
1171 | 1171 | if (d != NULL) |
1172 | 1172 | dentry = d; |
1173 | 1173 | if (dentry->d_inode) { |
1174 | - if (!(*opened & FILE_OPENED)) | |
1174 | + if (!(*opened & FILE_OPENED)) { | |
1175 | + if (d == NULL) | |
1176 | + dget(dentry); | |
1175 | 1177 | return finish_no_open(file, dentry); |
1178 | + } | |
1176 | 1179 | dput(d); |
1177 | 1180 | return 0; |
1178 | 1181 | } |