diff options
-rw-r--r-- | fs/ocfs2/aops.c | 44 | ||||
-rw-r--r-- | fs/ocfs2/cluster/tcp_internal.h | 5 | ||||
-rw-r--r-- | fs/ocfs2/dlmglue.c | 104 | ||||
-rw-r--r-- | fs/ocfs2/dlmglue.h | 11 | ||||
-rw-r--r-- | fs/ocfs2/file.c | 55 | ||||
-rw-r--r-- | fs/ocfs2/inode.c | 6 | ||||
-rw-r--r-- | fs/ocfs2/inode.h | 1 | ||||
-rw-r--r-- | fs/ocfs2/mmap.c | 9 | ||||
-rw-r--r-- | fs/ocfs2/super.c | 1 |
9 files changed, 22 insertions, 214 deletions
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c index 56f7790cad46..5fc27cfaee50 100644 --- a/fs/ocfs2/aops.c +++ b/fs/ocfs2/aops.c | |||
@@ -305,21 +305,12 @@ static int ocfs2_readpage(struct file *file, struct page *page) | |||
305 | goto out_alloc; | 305 | goto out_alloc; |
306 | } | 306 | } |
307 | 307 | ||
308 | ret = ocfs2_data_lock_with_page(inode, 0, page); | ||
309 | if (ret != 0) { | ||
310 | if (ret == AOP_TRUNCATED_PAGE) | ||
311 | unlock = 0; | ||
312 | mlog_errno(ret); | ||
313 | goto out_alloc; | ||
314 | } | ||
315 | |||
316 | if (oi->ip_dyn_features & OCFS2_INLINE_DATA_FL) | 308 | if (oi->ip_dyn_features & OCFS2_INLINE_DATA_FL) |
317 | ret = ocfs2_readpage_inline(inode, page); | 309 | ret = ocfs2_readpage_inline(inode, page); |
318 | else | 310 | else |
319 | ret = block_read_full_page(page, ocfs2_get_block); | 311 | ret = block_read_full_page(page, ocfs2_get_block); |
320 | unlock = 0; | 312 | unlock = 0; |
321 | 313 | ||
322 | ocfs2_data_unlock(inode, 0); | ||
323 | out_alloc: | 314 | out_alloc: |
324 | up_read(&OCFS2_I(inode)->ip_alloc_sem); | 315 | up_read(&OCFS2_I(inode)->ip_alloc_sem); |
325 | out_meta_unlock: | 316 | out_meta_unlock: |
@@ -638,34 +629,12 @@ static ssize_t ocfs2_direct_IO(int rw, | |||
638 | if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) | 629 | if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) |
639 | return 0; | 630 | return 0; |
640 | 631 | ||
641 | if (!ocfs2_sparse_alloc(OCFS2_SB(inode->i_sb))) { | ||
642 | /* | ||
643 | * We get PR data locks even for O_DIRECT. This | ||
644 | * allows concurrent O_DIRECT I/O but doesn't let | ||
645 | * O_DIRECT with extending and buffered zeroing writes | ||
646 | * race. If they did race then the buffered zeroing | ||
647 | * could be written back after the O_DIRECT I/O. It's | ||
648 | * one thing to tell people not to mix buffered and | ||
649 | * O_DIRECT writes, but expecting them to understand | ||
650 | * that file extension is also an implicit buffered | ||
651 | * write is too much. By getting the PR we force | ||
652 | * writeback of the buffered zeroing before | ||
653 | * proceeding. | ||
654 | */ | ||
655 | ret = ocfs2_data_lock(inode, 0); | ||
656 | if (ret < 0) { | ||
657 | mlog_errno(ret); | ||
658 | goto out; | ||
659 | } | ||
660 | ocfs2_data_unlock(inode, 0); | ||
661 | } | ||
662 | |||
663 | ret = blockdev_direct_IO_no_locking(rw, iocb, inode, | 632 | ret = blockdev_direct_IO_no_locking(rw, iocb, inode, |
664 | inode->i_sb->s_bdev, iov, offset, | 633 | inode->i_sb->s_bdev, iov, offset, |
665 | nr_segs, | 634 | nr_segs, |
666 | ocfs2_direct_IO_get_blocks, | 635 | ocfs2_direct_IO_get_blocks, |
667 | ocfs2_dio_end_io); | 636 | ocfs2_dio_end_io); |
668 | out: | 637 | |
669 | mlog_exit(ret); | 638 | mlog_exit(ret); |
670 | return ret; | 639 | return ret; |
671 | } | 640 | } |
@@ -1769,25 +1738,17 @@ static int ocfs2_write_begin(struct file *file, struct address_space *mapping, | |||
1769 | */ | 1738 | */ |
1770 | down_write(&OCFS2_I(inode)->ip_alloc_sem); | 1739 | down_write(&OCFS2_I(inode)->ip_alloc_sem); |
1771 | 1740 | ||
1772 | ret = ocfs2_data_lock(inode, 1); | ||
1773 | if (ret) { | ||
1774 | mlog_errno(ret); | ||
1775 | goto out_fail; | ||
1776 | } | ||
1777 | |||
1778 | ret = ocfs2_write_begin_nolock(mapping, pos, len, flags, pagep, | 1741 | ret = ocfs2_write_begin_nolock(mapping, pos, len, flags, pagep, |
1779 | fsdata, di_bh, NULL); | 1742 | fsdata, di_bh, NULL); |
1780 | if (ret) { | 1743 | if (ret) { |
1781 | mlog_errno(ret); | 1744 | mlog_errno(ret); |
1782 | goto out_fail_data; | 1745 | goto out_fail; |
1783 | } | 1746 | } |
1784 | 1747 | ||
1785 | brelse(di_bh); | 1748 | brelse(di_bh); |
1786 | 1749 | ||
1787 | return 0; | 1750 | return 0; |
1788 | 1751 | ||
1789 | out_fail_data: | ||
1790 | ocfs2_data_unlock(inode, 1); | ||
1791 | out_fail: | 1752 | out_fail: |
1792 | up_write(&OCFS2_I(inode)->ip_alloc_sem); | 1753 | up_write(&OCFS2_I(inode)->ip_alloc_sem); |
1793 | 1754 | ||
@@ -1908,7 +1869,6 @@ static int ocfs2_write_end(struct file *file, struct address_space *mapping, | |||
1908 | 1869 | ||
1909 | ret = ocfs2_write_end_nolock(mapping, pos, len, copied, page, fsdata); | 1870 | ret = ocfs2_write_end_nolock(mapping, pos, len, copied, page, fsdata); |
1910 | 1871 | ||
1911 | ocfs2_data_unlock(inode, 1); | ||
1912 | up_write(&OCFS2_I(inode)->ip_alloc_sem); | 1872 | up_write(&OCFS2_I(inode)->ip_alloc_sem); |
1913 | ocfs2_meta_unlock(inode, 1); | 1873 | ocfs2_meta_unlock(inode, 1); |
1914 | 1874 | ||
diff --git a/fs/ocfs2/cluster/tcp_internal.h b/fs/ocfs2/cluster/tcp_internal.h index 79bd6665b3ca..b2e832aca567 100644 --- a/fs/ocfs2/cluster/tcp_internal.h +++ b/fs/ocfs2/cluster/tcp_internal.h | |||
@@ -38,6 +38,9 @@ | |||
38 | * locking semantics of the file system using the protocol. It should | 38 | * locking semantics of the file system using the protocol. It should |
39 | * be somewhere else, I'm sure, but right now it isn't. | 39 | * be somewhere else, I'm sure, but right now it isn't. |
40 | * | 40 | * |
41 | * New in version 10: | ||
42 | * - Meta/data locks combined | ||
43 | * | ||
41 | * New in version 9: | 44 | * New in version 9: |
42 | * - All votes removed | 45 | * - All votes removed |
43 | * | 46 | * |
@@ -63,7 +66,7 @@ | |||
63 | * - full 64 bit i_size in the metadata lock lvbs | 66 | * - full 64 bit i_size in the metadata lock lvbs |
64 | * - introduction of "rw" lock and pushing meta/data locking down | 67 | * - introduction of "rw" lock and pushing meta/data locking down |
65 | */ | 68 | */ |
66 | #define O2NET_PROTOCOL_VERSION 9ULL | 69 | #define O2NET_PROTOCOL_VERSION 10ULL |
67 | struct o2net_handshake { | 70 | struct o2net_handshake { |
68 | __be64 protocol_version; | 71 | __be64 protocol_version; |
69 | __be64 connector_id; | 72 | __be64 connector_id; |
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c index 7e36abea8f40..ecf58c6e2fa3 100644 --- a/fs/ocfs2/dlmglue.c +++ b/fs/ocfs2/dlmglue.c | |||
@@ -232,12 +232,6 @@ static struct ocfs2_lock_res_ops ocfs2_inode_meta_lops = { | |||
232 | .flags = LOCK_TYPE_REQUIRES_REFRESH|LOCK_TYPE_USES_LVB, | 232 | .flags = LOCK_TYPE_REQUIRES_REFRESH|LOCK_TYPE_USES_LVB, |
233 | }; | 233 | }; |
234 | 234 | ||
235 | static struct ocfs2_lock_res_ops ocfs2_inode_data_lops = { | ||
236 | .get_osb = ocfs2_get_inode_osb, | ||
237 | .downconvert_worker = ocfs2_data_convert_worker, | ||
238 | .flags = 0, | ||
239 | }; | ||
240 | |||
241 | static struct ocfs2_lock_res_ops ocfs2_super_lops = { | 235 | static struct ocfs2_lock_res_ops ocfs2_super_lops = { |
242 | .flags = LOCK_TYPE_REQUIRES_REFRESH, | 236 | .flags = LOCK_TYPE_REQUIRES_REFRESH, |
243 | }; | 237 | }; |
@@ -261,7 +255,6 @@ static struct ocfs2_lock_res_ops ocfs2_inode_open_lops = { | |||
261 | static inline int ocfs2_is_inode_lock(struct ocfs2_lock_res *lockres) | 255 | static inline int ocfs2_is_inode_lock(struct ocfs2_lock_res *lockres) |
262 | { | 256 | { |
263 | return lockres->l_type == OCFS2_LOCK_TYPE_META || | 257 | return lockres->l_type == OCFS2_LOCK_TYPE_META || |
264 | lockres->l_type == OCFS2_LOCK_TYPE_DATA || | ||
265 | lockres->l_type == OCFS2_LOCK_TYPE_RW || | 258 | lockres->l_type == OCFS2_LOCK_TYPE_RW || |
266 | lockres->l_type == OCFS2_LOCK_TYPE_OPEN; | 259 | lockres->l_type == OCFS2_LOCK_TYPE_OPEN; |
267 | } | 260 | } |
@@ -405,9 +398,6 @@ void ocfs2_inode_lock_res_init(struct ocfs2_lock_res *res, | |||
405 | case OCFS2_LOCK_TYPE_META: | 398 | case OCFS2_LOCK_TYPE_META: |
406 | ops = &ocfs2_inode_meta_lops; | 399 | ops = &ocfs2_inode_meta_lops; |
407 | break; | 400 | break; |
408 | case OCFS2_LOCK_TYPE_DATA: | ||
409 | ops = &ocfs2_inode_data_lops; | ||
410 | break; | ||
411 | case OCFS2_LOCK_TYPE_OPEN: | 401 | case OCFS2_LOCK_TYPE_OPEN: |
412 | ops = &ocfs2_inode_open_lops; | 402 | ops = &ocfs2_inode_open_lops; |
413 | break; | 403 | break; |
@@ -1154,12 +1144,6 @@ int ocfs2_create_new_inode_locks(struct inode *inode) | |||
1154 | goto bail; | 1144 | goto bail; |
1155 | } | 1145 | } |
1156 | 1146 | ||
1157 | ret = ocfs2_create_new_lock(osb, &OCFS2_I(inode)->ip_data_lockres, 1, 1); | ||
1158 | if (ret) { | ||
1159 | mlog_errno(ret); | ||
1160 | goto bail; | ||
1161 | } | ||
1162 | |||
1163 | ret = ocfs2_create_new_lock(osb, &OCFS2_I(inode)->ip_open_lockres, 0, 0); | 1147 | ret = ocfs2_create_new_lock(osb, &OCFS2_I(inode)->ip_open_lockres, 0, 0); |
1164 | if (ret) { | 1148 | if (ret) { |
1165 | mlog_errno(ret); | 1149 | mlog_errno(ret); |
@@ -1312,67 +1296,6 @@ out: | |||
1312 | mlog_exit_void(); | 1296 | mlog_exit_void(); |
1313 | } | 1297 | } |
1314 | 1298 | ||
1315 | int ocfs2_data_lock_full(struct inode *inode, | ||
1316 | int write, | ||
1317 | int arg_flags) | ||
1318 | { | ||
1319 | int status = 0, level; | ||
1320 | struct ocfs2_lock_res *lockres; | ||
1321 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | ||
1322 | |||
1323 | BUG_ON(!inode); | ||
1324 | |||
1325 | mlog_entry_void(); | ||
1326 | |||
1327 | mlog(0, "inode %llu take %s DATA lock\n", | ||
1328 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | ||
1329 | write ? "EXMODE" : "PRMODE"); | ||
1330 | |||
1331 | /* We'll allow faking a readonly data lock for | ||
1332 | * rodevices. */ | ||
1333 | if (ocfs2_is_hard_readonly(OCFS2_SB(inode->i_sb))) { | ||
1334 | if (write) { | ||
1335 | status = -EROFS; | ||
1336 | mlog_errno(status); | ||
1337 | } | ||
1338 | goto out; | ||
1339 | } | ||
1340 | |||
1341 | if (ocfs2_mount_local(osb)) | ||
1342 | goto out; | ||
1343 | |||
1344 | lockres = &OCFS2_I(inode)->ip_data_lockres; | ||
1345 | |||
1346 | level = write ? LKM_EXMODE : LKM_PRMODE; | ||
1347 | |||
1348 | status = ocfs2_cluster_lock(OCFS2_SB(inode->i_sb), lockres, level, | ||
1349 | 0, arg_flags); | ||
1350 | if (status < 0 && status != -EAGAIN) | ||
1351 | mlog_errno(status); | ||
1352 | |||
1353 | out: | ||
1354 | mlog_exit(status); | ||
1355 | return status; | ||
1356 | } | ||
1357 | |||
1358 | /* see ocfs2_meta_lock_with_page() */ | ||
1359 | int ocfs2_data_lock_with_page(struct inode *inode, | ||
1360 | int write, | ||
1361 | struct page *page) | ||
1362 | { | ||
1363 | int ret; | ||
1364 | |||
1365 | ret = ocfs2_data_lock_full(inode, write, OCFS2_LOCK_NONBLOCK); | ||
1366 | if (ret == -EAGAIN) { | ||
1367 | unlock_page(page); | ||
1368 | if (ocfs2_data_lock(inode, write) == 0) | ||
1369 | ocfs2_data_unlock(inode, write); | ||
1370 | ret = AOP_TRUNCATED_PAGE; | ||
1371 | } | ||
1372 | |||
1373 | return ret; | ||
1374 | } | ||
1375 | |||
1376 | static void ocfs2_downconvert_on_unlock(struct ocfs2_super *osb, | 1299 | static void ocfs2_downconvert_on_unlock(struct ocfs2_super *osb, |
1377 | struct ocfs2_lock_res *lockres) | 1300 | struct ocfs2_lock_res *lockres) |
1378 | { | 1301 | { |
@@ -1404,26 +1327,6 @@ static void ocfs2_downconvert_on_unlock(struct ocfs2_super *osb, | |||
1404 | mlog_exit_void(); | 1327 | mlog_exit_void(); |
1405 | } | 1328 | } |
1406 | 1329 | ||
1407 | void ocfs2_data_unlock(struct inode *inode, | ||
1408 | int write) | ||
1409 | { | ||
1410 | int level = write ? LKM_EXMODE : LKM_PRMODE; | ||
1411 | struct ocfs2_lock_res *lockres = &OCFS2_I(inode)->ip_data_lockres; | ||
1412 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | ||
1413 | |||
1414 | mlog_entry_void(); | ||
1415 | |||
1416 | mlog(0, "inode %llu drop %s DATA lock\n", | ||
1417 | (unsigned long long)OCFS2_I(inode)->ip_blkno, | ||
1418 | write ? "EXMODE" : "PRMODE"); | ||
1419 | |||
1420 | if (!ocfs2_is_hard_readonly(OCFS2_SB(inode->i_sb)) && | ||
1421 | !ocfs2_mount_local(osb)) | ||
1422 | ocfs2_cluster_unlock(OCFS2_SB(inode->i_sb), lockres, level); | ||
1423 | |||
1424 | mlog_exit_void(); | ||
1425 | } | ||
1426 | |||
1427 | #define OCFS2_SEC_BITS 34 | 1330 | #define OCFS2_SEC_BITS 34 |
1428 | #define OCFS2_SEC_SHIFT (64 - 34) | 1331 | #define OCFS2_SEC_SHIFT (64 - 34) |
1429 | #define OCFS2_NSEC_MASK ((1ULL << OCFS2_SEC_SHIFT) - 1) | 1332 | #define OCFS2_NSEC_MASK ((1ULL << OCFS2_SEC_SHIFT) - 1) |
@@ -2592,13 +2495,6 @@ int ocfs2_drop_inode_locks(struct inode *inode) | |||
2592 | status = err; | 2495 | status = err; |
2593 | 2496 | ||
2594 | err = ocfs2_drop_lock(OCFS2_SB(inode->i_sb), | 2497 | err = ocfs2_drop_lock(OCFS2_SB(inode->i_sb), |
2595 | &OCFS2_I(inode)->ip_data_lockres); | ||
2596 | if (err < 0) | ||
2597 | mlog_errno(err); | ||
2598 | if (err < 0 && !status) | ||
2599 | status = err; | ||
2600 | |||
2601 | err = ocfs2_drop_lock(OCFS2_SB(inode->i_sb), | ||
2602 | &OCFS2_I(inode)->ip_meta_lockres); | 2498 | &OCFS2_I(inode)->ip_meta_lockres); |
2603 | if (err < 0) | 2499 | if (err < 0) |
2604 | mlog_errno(err); | 2500 | mlog_errno(err); |
diff --git a/fs/ocfs2/dlmglue.h b/fs/ocfs2/dlmglue.h index 931f6ee55146..3fd7729daeef 100644 --- a/fs/ocfs2/dlmglue.h +++ b/fs/ocfs2/dlmglue.h | |||
@@ -49,7 +49,7 @@ struct ocfs2_meta_lvb { | |||
49 | __be32 lvb_reserved2; | 49 | __be32 lvb_reserved2; |
50 | }; | 50 | }; |
51 | 51 | ||
52 | /* ocfs2_meta_lock_full() and ocfs2_data_lock_full() 'arg_flags' flags */ | 52 | /* ocfs2_meta_lock_full() 'arg_flags' flags */ |
53 | /* don't wait on recovery. */ | 53 | /* don't wait on recovery. */ |
54 | #define OCFS2_META_LOCK_RECOVERY (0x01) | 54 | #define OCFS2_META_LOCK_RECOVERY (0x01) |
55 | /* Instruct the dlm not to queue ourselves on the other node. */ | 55 | /* Instruct the dlm not to queue ourselves on the other node. */ |
@@ -69,15 +69,6 @@ void ocfs2_dentry_lock_res_init(struct ocfs2_dentry_lock *dl, | |||
69 | void ocfs2_lock_res_free(struct ocfs2_lock_res *res); | 69 | void ocfs2_lock_res_free(struct ocfs2_lock_res *res); |
70 | int ocfs2_create_new_inode_locks(struct inode *inode); | 70 | int ocfs2_create_new_inode_locks(struct inode *inode); |
71 | int ocfs2_drop_inode_locks(struct inode *inode); | 71 | int ocfs2_drop_inode_locks(struct inode *inode); |
72 | int ocfs2_data_lock_full(struct inode *inode, | ||
73 | int write, | ||
74 | int arg_flags); | ||
75 | #define ocfs2_data_lock(inode, write) ocfs2_data_lock_full(inode, write, 0) | ||
76 | int ocfs2_data_lock_with_page(struct inode *inode, | ||
77 | int write, | ||
78 | struct page *page); | ||
79 | void ocfs2_data_unlock(struct inode *inode, | ||
80 | int write); | ||
81 | int ocfs2_rw_lock(struct inode *inode, int write); | 72 | int ocfs2_rw_lock(struct inode *inode, int write); |
82 | void ocfs2_rw_unlock(struct inode *inode, int write); | 73 | void ocfs2_rw_unlock(struct inode *inode, int write); |
83 | int ocfs2_open_lock(struct inode *inode); | 74 | int ocfs2_open_lock(struct inode *inode); |
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index b75b2e1f0e42..c5c183ac41fe 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -382,18 +382,13 @@ static int ocfs2_truncate_file(struct inode *inode, | |||
382 | 382 | ||
383 | down_write(&OCFS2_I(inode)->ip_alloc_sem); | 383 | down_write(&OCFS2_I(inode)->ip_alloc_sem); |
384 | 384 | ||
385 | /* This forces other nodes to sync and drop their pages. Do | 385 | /* |
386 | * this even if we have a truncate without allocation change - | 386 | * The inode lock forced other nodes to sync and drop their |
387 | * ocfs2 cluster sizes can be much greater than page size, so | 387 | * pages, which (correctly) happens even if we have a truncate |
388 | * we have to truncate them anyway. */ | 388 | * without allocation change - ocfs2 cluster sizes can be much |
389 | status = ocfs2_data_lock(inode, 1); | 389 | * greater than page size, so we have to truncate them |
390 | if (status < 0) { | 390 | * anyway. |
391 | up_write(&OCFS2_I(inode)->ip_alloc_sem); | 391 | */ |
392 | |||
393 | mlog_errno(status); | ||
394 | goto bail; | ||
395 | } | ||
396 | |||
397 | unmap_mapping_range(inode->i_mapping, new_i_size + PAGE_SIZE - 1, 0, 1); | 392 | unmap_mapping_range(inode->i_mapping, new_i_size + PAGE_SIZE - 1, 0, 1); |
398 | truncate_inode_pages(inode->i_mapping, new_i_size); | 393 | truncate_inode_pages(inode->i_mapping, new_i_size); |
399 | 394 | ||
@@ -403,7 +398,7 @@ static int ocfs2_truncate_file(struct inode *inode, | |||
403 | if (status) | 398 | if (status) |
404 | mlog_errno(status); | 399 | mlog_errno(status); |
405 | 400 | ||
406 | goto bail_unlock_data; | 401 | goto bail_unlock_sem; |
407 | } | 402 | } |
408 | 403 | ||
409 | /* alright, we're going to need to do a full blown alloc size | 404 | /* alright, we're going to need to do a full blown alloc size |
@@ -413,25 +408,23 @@ static int ocfs2_truncate_file(struct inode *inode, | |||
413 | status = ocfs2_orphan_for_truncate(osb, inode, di_bh, new_i_size); | 408 | status = ocfs2_orphan_for_truncate(osb, inode, di_bh, new_i_size); |
414 | if (status < 0) { | 409 | if (status < 0) { |
415 | mlog_errno(status); | 410 | mlog_errno(status); |
416 | goto bail_unlock_data; | 411 | goto bail_unlock_sem; |
417 | } | 412 | } |
418 | 413 | ||
419 | status = ocfs2_prepare_truncate(osb, inode, di_bh, &tc); | 414 | status = ocfs2_prepare_truncate(osb, inode, di_bh, &tc); |
420 | if (status < 0) { | 415 | if (status < 0) { |
421 | mlog_errno(status); | 416 | mlog_errno(status); |
422 | goto bail_unlock_data; | 417 | goto bail_unlock_sem; |
423 | } | 418 | } |
424 | 419 | ||
425 | status = ocfs2_commit_truncate(osb, inode, di_bh, tc); | 420 | status = ocfs2_commit_truncate(osb, inode, di_bh, tc); |
426 | if (status < 0) { | 421 | if (status < 0) { |
427 | mlog_errno(status); | 422 | mlog_errno(status); |
428 | goto bail_unlock_data; | 423 | goto bail_unlock_sem; |
429 | } | 424 | } |
430 | 425 | ||
431 | /* TODO: orphan dir cleanup here. */ | 426 | /* TODO: orphan dir cleanup here. */ |
432 | bail_unlock_data: | 427 | bail_unlock_sem: |
433 | ocfs2_data_unlock(inode, 1); | ||
434 | |||
435 | up_write(&OCFS2_I(inode)->ip_alloc_sem); | 428 | up_write(&OCFS2_I(inode)->ip_alloc_sem); |
436 | 429 | ||
437 | bail: | 430 | bail: |
@@ -917,7 +910,7 @@ static int ocfs2_extend_file(struct inode *inode, | |||
917 | struct buffer_head *di_bh, | 910 | struct buffer_head *di_bh, |
918 | u64 new_i_size) | 911 | u64 new_i_size) |
919 | { | 912 | { |
920 | int ret = 0, data_locked = 0; | 913 | int ret = 0; |
921 | struct ocfs2_inode_info *oi = OCFS2_I(inode); | 914 | struct ocfs2_inode_info *oi = OCFS2_I(inode); |
922 | 915 | ||
923 | BUG_ON(!di_bh); | 916 | BUG_ON(!di_bh); |
@@ -943,20 +936,6 @@ static int ocfs2_extend_file(struct inode *inode, | |||
943 | && ocfs2_sparse_alloc(OCFS2_SB(inode->i_sb))) | 936 | && ocfs2_sparse_alloc(OCFS2_SB(inode->i_sb))) |
944 | goto out_update_size; | 937 | goto out_update_size; |
945 | 938 | ||
946 | /* | ||
947 | * protect the pages that ocfs2_zero_extend is going to be | ||
948 | * pulling into the page cache.. we do this before the | ||
949 | * metadata extend so that we don't get into the situation | ||
950 | * where we've extended the metadata but can't get the data | ||
951 | * lock to zero. | ||
952 | */ | ||
953 | ret = ocfs2_data_lock(inode, 1); | ||
954 | if (ret < 0) { | ||
955 | mlog_errno(ret); | ||
956 | goto out; | ||
957 | } | ||
958 | data_locked = 1; | ||
959 | |||
960 | /* | 939 | /* |
961 | * The alloc sem blocks people in read/write from reading our | 940 | * The alloc sem blocks people in read/write from reading our |
962 | * allocation until we're done changing it. We depend on | 941 | * allocation until we're done changing it. We depend on |
@@ -980,7 +959,7 @@ static int ocfs2_extend_file(struct inode *inode, | |||
980 | up_write(&oi->ip_alloc_sem); | 959 | up_write(&oi->ip_alloc_sem); |
981 | 960 | ||
982 | mlog_errno(ret); | 961 | mlog_errno(ret); |
983 | goto out_unlock; | 962 | goto out; |
984 | } | 963 | } |
985 | } | 964 | } |
986 | 965 | ||
@@ -991,7 +970,7 @@ static int ocfs2_extend_file(struct inode *inode, | |||
991 | 970 | ||
992 | if (ret < 0) { | 971 | if (ret < 0) { |
993 | mlog_errno(ret); | 972 | mlog_errno(ret); |
994 | goto out_unlock; | 973 | goto out; |
995 | } | 974 | } |
996 | 975 | ||
997 | out_update_size: | 976 | out_update_size: |
@@ -999,10 +978,6 @@ out_update_size: | |||
999 | if (ret < 0) | 978 | if (ret < 0) |
1000 | mlog_errno(ret); | 979 | mlog_errno(ret); |
1001 | 980 | ||
1002 | out_unlock: | ||
1003 | if (data_locked) | ||
1004 | ocfs2_data_unlock(inode, 1); | ||
1005 | |||
1006 | out: | 981 | out: |
1007 | return ret; | 982 | return ret; |
1008 | } | 983 | } |
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index 86cf073996b5..8ff201d3705e 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c | |||
@@ -332,10 +332,6 @@ int ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe, | |||
332 | OCFS2_LOCK_TYPE_RW, inode->i_generation, | 332 | OCFS2_LOCK_TYPE_RW, inode->i_generation, |
333 | inode); | 333 | inode); |
334 | 334 | ||
335 | ocfs2_inode_lock_res_init(&OCFS2_I(inode)->ip_data_lockres, | ||
336 | OCFS2_LOCK_TYPE_DATA, inode->i_generation, | ||
337 | inode); | ||
338 | |||
339 | ocfs2_set_inode_flags(inode); | 335 | ocfs2_set_inode_flags(inode); |
340 | 336 | ||
341 | status = 0; | 337 | status = 0; |
@@ -1014,7 +1010,6 @@ void ocfs2_clear_inode(struct inode *inode) | |||
1014 | * the downconvert thread while waiting to destroy the locks. */ | 1010 | * the downconvert thread while waiting to destroy the locks. */ |
1015 | ocfs2_mark_lockres_freeing(&oi->ip_rw_lockres); | 1011 | ocfs2_mark_lockres_freeing(&oi->ip_rw_lockres); |
1016 | ocfs2_mark_lockres_freeing(&oi->ip_meta_lockres); | 1012 | ocfs2_mark_lockres_freeing(&oi->ip_meta_lockres); |
1017 | ocfs2_mark_lockres_freeing(&oi->ip_data_lockres); | ||
1018 | ocfs2_mark_lockres_freeing(&oi->ip_open_lockres); | 1013 | ocfs2_mark_lockres_freeing(&oi->ip_open_lockres); |
1019 | 1014 | ||
1020 | /* We very well may get a clear_inode before all an inodes | 1015 | /* We very well may get a clear_inode before all an inodes |
@@ -1038,7 +1033,6 @@ void ocfs2_clear_inode(struct inode *inode) | |||
1038 | 1033 | ||
1039 | ocfs2_lock_res_free(&oi->ip_rw_lockres); | 1034 | ocfs2_lock_res_free(&oi->ip_rw_lockres); |
1040 | ocfs2_lock_res_free(&oi->ip_meta_lockres); | 1035 | ocfs2_lock_res_free(&oi->ip_meta_lockres); |
1041 | ocfs2_lock_res_free(&oi->ip_data_lockres); | ||
1042 | ocfs2_lock_res_free(&oi->ip_open_lockres); | 1036 | ocfs2_lock_res_free(&oi->ip_open_lockres); |
1043 | 1037 | ||
1044 | ocfs2_metadata_cache_purge(inode); | 1038 | ocfs2_metadata_cache_purge(inode); |
diff --git a/fs/ocfs2/inode.h b/fs/ocfs2/inode.h index 70e881c55536..d1c54da687c9 100644 --- a/fs/ocfs2/inode.h +++ b/fs/ocfs2/inode.h | |||
@@ -35,7 +35,6 @@ struct ocfs2_inode_info | |||
35 | 35 | ||
36 | struct ocfs2_lock_res ip_rw_lockres; | 36 | struct ocfs2_lock_res ip_rw_lockres; |
37 | struct ocfs2_lock_res ip_meta_lockres; | 37 | struct ocfs2_lock_res ip_meta_lockres; |
38 | struct ocfs2_lock_res ip_data_lockres; | ||
39 | struct ocfs2_lock_res ip_open_lockres; | 38 | struct ocfs2_lock_res ip_open_lockres; |
40 | 39 | ||
41 | /* protects allocation changes on this inode. */ | 40 | /* protects allocation changes on this inode. */ |
diff --git a/fs/ocfs2/mmap.c b/fs/ocfs2/mmap.c index 98756156d298..a7f0ccc6fdd8 100644 --- a/fs/ocfs2/mmap.c +++ b/fs/ocfs2/mmap.c | |||
@@ -181,17 +181,8 @@ static int ocfs2_page_mkwrite(struct vm_area_struct *vma, struct page *page) | |||
181 | */ | 181 | */ |
182 | down_write(&OCFS2_I(inode)->ip_alloc_sem); | 182 | down_write(&OCFS2_I(inode)->ip_alloc_sem); |
183 | 183 | ||
184 | ret = ocfs2_data_lock(inode, 1); | ||
185 | if (ret < 0) { | ||
186 | mlog_errno(ret); | ||
187 | goto out_meta_unlock; | ||
188 | } | ||
189 | |||
190 | ret = __ocfs2_page_mkwrite(inode, di_bh, page); | 184 | ret = __ocfs2_page_mkwrite(inode, di_bh, page); |
191 | 185 | ||
192 | ocfs2_data_unlock(inode, 1); | ||
193 | |||
194 | out_meta_unlock: | ||
195 | up_write(&OCFS2_I(inode)->ip_alloc_sem); | 186 | up_write(&OCFS2_I(inode)->ip_alloc_sem); |
196 | 187 | ||
197 | brelse(di_bh); | 188 | brelse(di_bh); |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 1996820488cc..064eba074f1e 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -1020,7 +1020,6 @@ static void ocfs2_inode_init_once(struct kmem_cache *cachep, void *data) | |||
1020 | 1020 | ||
1021 | ocfs2_lock_res_init_once(&oi->ip_rw_lockres); | 1021 | ocfs2_lock_res_init_once(&oi->ip_rw_lockres); |
1022 | ocfs2_lock_res_init_once(&oi->ip_meta_lockres); | 1022 | ocfs2_lock_res_init_once(&oi->ip_meta_lockres); |
1023 | ocfs2_lock_res_init_once(&oi->ip_data_lockres); | ||
1024 | ocfs2_lock_res_init_once(&oi->ip_open_lockres); | 1023 | ocfs2_lock_res_init_once(&oi->ip_open_lockres); |
1025 | 1024 | ||
1026 | ocfs2_metadata_cache_init(&oi->vfs_inode); | 1025 | ocfs2_metadata_cache_init(&oi->vfs_inode); |