diff options
author | Steve French <sfrench@us.ibm.com> | 2007-08-22 18:12:07 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2007-08-22 18:12:07 -0400 |
commit | 8064ab4da104900505f33535d230ce0da5d18341 (patch) | |
tree | ca74f036c75ffae39d1256de7a041f9df4882da1 | |
parent | cb00e99c0abd844b884c64c6b54aa3b7d345ebb1 (diff) |
[CIFS] cifs truncate missing a fix for private map COW race
vmtruncate had added the same fix to handle the case of private pages
being Copy on writed while truncate_inode_pages is going on
Signed-off-by: Steve French <sfrench@us.ibm.com>
-rw-r--r-- | fs/cifs/inode.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index dd4167762a8e..97ccc513730f 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -1377,8 +1377,17 @@ static int cifs_vmtruncate(struct inode *inode, loff_t offset) | |||
1377 | } | 1377 | } |
1378 | i_size_write(inode, offset); | 1378 | i_size_write(inode, offset); |
1379 | spin_unlock(&inode->i_lock); | 1379 | spin_unlock(&inode->i_lock); |
1380 | /* | ||
1381 | * unmap_mapping_range is called twice, first simply for efficiency | ||
1382 | * so that truncate_inode_pages does fewer single-page unmaps. However | ||
1383 | * after this first call, and before truncate_inode_pages finishes, | ||
1384 | * it is possible for private pages to be COWed, which remain after | ||
1385 | * truncate_inode_pages finishes, hence the second unmap_mapping_range | ||
1386 | * call must be made for correctness. | ||
1387 | */ | ||
1380 | unmap_mapping_range(mapping, offset + PAGE_SIZE - 1, 0, 1); | 1388 | unmap_mapping_range(mapping, offset + PAGE_SIZE - 1, 0, 1); |
1381 | truncate_inode_pages(mapping, offset); | 1389 | truncate_inode_pages(mapping, offset); |
1390 | unmap_mapping_range(mapping, offset + PAGE_SIZE - 1, 0, 1); | ||
1382 | goto out_truncate; | 1391 | goto out_truncate; |
1383 | 1392 | ||
1384 | do_expand: | 1393 | do_expand: |