diff options
Diffstat (limited to 'fs/ocfs2/file.c')
-rw-r--r-- | fs/ocfs2/file.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index 7602783d7f41..46a1f6d75104 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -1971,6 +1971,7 @@ int ocfs2_change_file_space(struct file *file, unsigned int cmd, | |||
1971 | { | 1971 | { |
1972 | struct inode *inode = file->f_path.dentry->d_inode; | 1972 | struct inode *inode = file->f_path.dentry->d_inode; |
1973 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 1973 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
1974 | int ret; | ||
1974 | 1975 | ||
1975 | if ((cmd == OCFS2_IOC_RESVSP || cmd == OCFS2_IOC_RESVSP64) && | 1976 | if ((cmd == OCFS2_IOC_RESVSP || cmd == OCFS2_IOC_RESVSP64) && |
1976 | !ocfs2_writes_unwritten_extents(osb)) | 1977 | !ocfs2_writes_unwritten_extents(osb)) |
@@ -1985,7 +1986,12 @@ int ocfs2_change_file_space(struct file *file, unsigned int cmd, | |||
1985 | if (!(file->f_mode & FMODE_WRITE)) | 1986 | if (!(file->f_mode & FMODE_WRITE)) |
1986 | return -EBADF; | 1987 | return -EBADF; |
1987 | 1988 | ||
1988 | return __ocfs2_change_file_space(file, inode, file->f_pos, cmd, sr, 0); | 1989 | ret = mnt_want_write_file(file); |
1990 | if (ret) | ||
1991 | return ret; | ||
1992 | ret = __ocfs2_change_file_space(file, inode, file->f_pos, cmd, sr, 0); | ||
1993 | mnt_drop_write_file(file); | ||
1994 | return ret; | ||
1989 | } | 1995 | } |
1990 | 1996 | ||
1991 | static long ocfs2_fallocate(struct file *file, int mode, loff_t offset, | 1997 | static long ocfs2_fallocate(struct file *file, int mode, loff_t offset, |
@@ -2261,7 +2267,7 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb, | |||
2261 | if (iocb->ki_left == 0) | 2267 | if (iocb->ki_left == 0) |
2262 | return 0; | 2268 | return 0; |
2263 | 2269 | ||
2264 | vfs_check_frozen(inode->i_sb, SB_FREEZE_WRITE); | 2270 | sb_start_write(inode->i_sb); |
2265 | 2271 | ||
2266 | appending = file->f_flags & O_APPEND ? 1 : 0; | 2272 | appending = file->f_flags & O_APPEND ? 1 : 0; |
2267 | direct_io = file->f_flags & O_DIRECT ? 1 : 0; | 2273 | direct_io = file->f_flags & O_DIRECT ? 1 : 0; |
@@ -2436,6 +2442,7 @@ out_sems: | |||
2436 | ocfs2_iocb_clear_sem_locked(iocb); | 2442 | ocfs2_iocb_clear_sem_locked(iocb); |
2437 | 2443 | ||
2438 | mutex_unlock(&inode->i_mutex); | 2444 | mutex_unlock(&inode->i_mutex); |
2445 | sb_end_write(inode->i_sb); | ||
2439 | 2446 | ||
2440 | if (written) | 2447 | if (written) |
2441 | ret = written; | 2448 | ret = written; |