diff options
author | Jan Kara <jack@suse.cz> | 2012-06-12 10:20:39 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-07-31 01:45:48 -0400 |
commit | d9457dc056249913a7abe8b71dc09e427e590e35 (patch) | |
tree | 8f0c6681d4c5802a6f5a124111b9d3958f0b281b /fs/xfs/xfs_aops.c | |
parent | 8e8ad8a57c75f3bda2d03a4c4396a9a7024ad275 (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_aops.c')
-rw-r--r-- | fs/xfs/xfs_aops.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index 8dad722c004..daa42383ebd 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c | |||
@@ -124,6 +124,12 @@ xfs_setfilesize_trans_alloc( | |||
124 | ioend->io_append_trans = tp; | 124 | ioend->io_append_trans = tp; |
125 | 125 | ||
126 | /* | 126 | /* |
127 | * We will pass freeze protection with a transaction. So tell lockdep | ||
128 | * we released it. | ||
129 | */ | ||
130 | rwsem_release(&ioend->io_inode->i_sb->s_writers.lock_map[SB_FREEZE_FS-1], | ||
131 | 1, _THIS_IP_); | ||
132 | /* | ||
127 | * We hand off the transaction to the completion thread now, so | 133 | * We hand off the transaction to the completion thread now, so |
128 | * clear the flag here. | 134 | * clear the flag here. |
129 | */ | 135 | */ |
@@ -199,6 +205,15 @@ xfs_end_io( | |||
199 | struct xfs_inode *ip = XFS_I(ioend->io_inode); | 205 | struct xfs_inode *ip = XFS_I(ioend->io_inode); |
200 | int error = 0; | 206 | int error = 0; |
201 | 207 | ||
208 | if (ioend->io_append_trans) { | ||
209 | /* | ||
210 | * We've got freeze protection passed with the transaction. | ||
211 | * Tell lockdep about it. | ||
212 | */ | ||
213 | rwsem_acquire_read( | ||
214 | &ioend->io_inode->i_sb->s_writers.lock_map[SB_FREEZE_FS-1], | ||
215 | 0, 1, _THIS_IP_); | ||
216 | } | ||
202 | if (XFS_FORCED_SHUTDOWN(ip->i_mount)) { | 217 | if (XFS_FORCED_SHUTDOWN(ip->i_mount)) { |
203 | ioend->io_error = -EIO; | 218 | ioend->io_error = -EIO; |
204 | goto done; | 219 | goto done; |
@@ -1410,6 +1425,9 @@ out_trans_cancel: | |||
1410 | if (ioend->io_append_trans) { | 1425 | if (ioend->io_append_trans) { |
1411 | current_set_flags_nested(&ioend->io_append_trans->t_pflags, | 1426 | current_set_flags_nested(&ioend->io_append_trans->t_pflags, |
1412 | PF_FSTRANS); | 1427 | PF_FSTRANS); |
1428 | rwsem_acquire_read( | ||
1429 | &inode->i_sb->s_writers.lock_map[SB_FREEZE_FS-1], | ||
1430 | 0, 1, _THIS_IP_); | ||
1413 | xfs_trans_cancel(ioend->io_append_trans, 0); | 1431 | xfs_trans_cancel(ioend->io_append_trans, 0); |
1414 | } | 1432 | } |
1415 | out_destroy_ioend: | 1433 | out_destroy_ioend: |