aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_file.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2012-06-12 10:20:39 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-07-31 01:45:48 -0400
commitd9457dc056249913a7abe8b71dc09e427e590e35 (patch)
tree8f0c6681d4c5802a6f5a124111b9d3958f0b281b /fs/xfs/xfs_file.c
parent8e8ad8a57c75f3bda2d03a4c4396a9a7024ad275 (diff)
xfs: Convert to new freezing code
Generic code now blocks all writers from standard write paths. So we add blocking of all writers coming from ioctl (we get a protection of ioctl against racing remount read-only as a bonus) and convert xfs_file_aio_write() to a non-racy freeze protection. We also keep freeze protection on transaction start to block internal filesystem writes such as removal of preallocated blocks. CC: Ben Myers <bpm@sgi.com> CC: Alex Elder <elder@kernel.org> CC: xfs@oss.sgi.com Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/xfs/xfs_file.c')
-rw-r--r--fs/xfs/xfs_file.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index 9f7ec15a6522..f0081f20e5c0 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -781,10 +781,12 @@ xfs_file_aio_write(
781 if (ocount == 0) 781 if (ocount == 0)
782 return 0; 782 return 0;
783 783
784 xfs_wait_for_freeze(ip->i_mount, SB_FREEZE_WRITE); 784 sb_start_write(inode->i_sb);
785 785
786 if (XFS_FORCED_SHUTDOWN(ip->i_mount)) 786 if (XFS_FORCED_SHUTDOWN(ip->i_mount)) {
787 return -EIO; 787 ret = -EIO;
788 goto out;
789 }
788 790
789 if (unlikely(file->f_flags & O_DIRECT)) 791 if (unlikely(file->f_flags & O_DIRECT))
790 ret = xfs_file_dio_aio_write(iocb, iovp, nr_segs, pos, ocount); 792 ret = xfs_file_dio_aio_write(iocb, iovp, nr_segs, pos, ocount);
@@ -803,6 +805,8 @@ xfs_file_aio_write(
803 ret = err; 805 ret = err;
804 } 806 }
805 807
808out:
809 sb_end_write(inode->i_sb);
806 return ret; 810 return ret;
807} 811}
808 812