aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ocfs2')
-rw-r--r--fs/ocfs2/aops.c2
-rw-r--r--fs/ocfs2/cluster/heartbeat.c4
-rw-r--r--fs/ocfs2/cluster/tcp.c2
-rw-r--r--fs/ocfs2/dir.c2
-rw-r--r--fs/ocfs2/dlm/dlmdomain.c2
-rw-r--r--fs/ocfs2/dlm/dlmmaster.c12
-rw-r--r--fs/ocfs2/dlm/dlmrecovery.c18
-rw-r--r--fs/ocfs2/dlmglue.c37
-rw-r--r--fs/ocfs2/file.c4
-rw-r--r--fs/ocfs2/inode.c3
-rw-r--r--fs/ocfs2/move_extents.c3
-rw-r--r--fs/ocfs2/ocfs2.h6
-rw-r--r--fs/ocfs2/slot_map.c2
-rw-r--r--fs/ocfs2/super.c3
-rw-r--r--fs/ocfs2/xattr.c2
15 files changed, 74 insertions, 28 deletions
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index 1ef547e49373..d9f222987f24 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -1251,7 +1251,7 @@ static int ocfs2_write_cluster(struct address_space *mapping,
1251 ret = ocfs2_extent_map_get_blocks(inode, v_blkno, &p_blkno, NULL, 1251 ret = ocfs2_extent_map_get_blocks(inode, v_blkno, &p_blkno, NULL,
1252 NULL); 1252 NULL);
1253 if (ret < 0) { 1253 if (ret < 0) {
1254 ocfs2_error(inode->i_sb, "Corrupting extend for inode %llu, " 1254 mlog(ML_ERROR, "Get physical blkno failed for inode %llu, "
1255 "at logical block %llu", 1255 "at logical block %llu",
1256 (unsigned long long)OCFS2_I(inode)->ip_blkno, 1256 (unsigned long long)OCFS2_I(inode)->ip_blkno,
1257 (unsigned long long)v_blkno); 1257 (unsigned long long)v_blkno);
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c
index eb9d48746ab4..16eff45727ee 100644
--- a/fs/ocfs2/cluster/heartbeat.c
+++ b/fs/ocfs2/cluster/heartbeat.c
@@ -1127,10 +1127,10 @@ static int o2hb_thread(void *data)
1127 elapsed_msec = o2hb_elapsed_msecs(&before_hb, &after_hb); 1127 elapsed_msec = o2hb_elapsed_msecs(&before_hb, &after_hb);
1128 1128
1129 mlog(ML_HEARTBEAT, 1129 mlog(ML_HEARTBEAT,
1130 "start = %lu.%lu, end = %lu.%lu, msec = %u\n", 1130 "start = %lu.%lu, end = %lu.%lu, msec = %u, ret = %d\n",
1131 before_hb.tv_sec, (unsigned long) before_hb.tv_usec, 1131 before_hb.tv_sec, (unsigned long) before_hb.tv_usec,
1132 after_hb.tv_sec, (unsigned long) after_hb.tv_usec, 1132 after_hb.tv_sec, (unsigned long) after_hb.tv_usec,
1133 elapsed_msec); 1133 elapsed_msec, ret);
1134 1134
1135 if (!kthread_should_stop() && 1135 if (!kthread_should_stop() &&
1136 elapsed_msec < reg->hr_timeout_ms) { 1136 elapsed_msec < reg->hr_timeout_ms) {
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
index a96044004064..2e355e0f8335 100644
--- a/fs/ocfs2/cluster/tcp.c
+++ b/fs/ocfs2/cluster/tcp.c
@@ -1736,7 +1736,7 @@ static void o2net_connect_expired(struct work_struct *work)
1736 o2net_idle_timeout() / 1000, 1736 o2net_idle_timeout() / 1000,
1737 o2net_idle_timeout() % 1000); 1737 o2net_idle_timeout() % 1000);
1738 1738
1739 o2net_set_nn_state(nn, NULL, 0, -ENOTCONN); 1739 o2net_set_nn_state(nn, NULL, 0, 0);
1740 } 1740 }
1741 spin_unlock(&nn->nn_lock); 1741 spin_unlock(&nn->nn_lock);
1742} 1742}
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c
index c43d9b4a1ec0..79d56dc981bc 100644
--- a/fs/ocfs2/dir.c
+++ b/fs/ocfs2/dir.c
@@ -744,7 +744,7 @@ restart:
744 if (ocfs2_read_dir_block(dir, block, &bh, 0)) { 744 if (ocfs2_read_dir_block(dir, block, &bh, 0)) {
745 /* read error, skip block & hope for the best. 745 /* read error, skip block & hope for the best.
746 * ocfs2_read_dir_block() has released the bh. */ 746 * ocfs2_read_dir_block() has released the bh. */
747 ocfs2_error(dir->i_sb, "reading directory %llu, " 747 mlog(ML_ERROR, "reading directory %llu, "
748 "offset %lu\n", 748 "offset %lu\n",
749 (unsigned long long)OCFS2_I(dir)->ip_blkno, 749 (unsigned long long)OCFS2_I(dir)->ip_blkno,
750 block); 750 block);
diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c
index 02d315fef432..50a59d2337b2 100644
--- a/fs/ocfs2/dlm/dlmdomain.c
+++ b/fs/ocfs2/dlm/dlmdomain.c
@@ -877,7 +877,7 @@ static int dlm_query_join_handler(struct o2net_msg *msg, u32 len, void *data,
877 * to be put in someone's domain map. 877 * to be put in someone's domain map.
878 * Also, explicitly disallow joining at certain troublesome 878 * Also, explicitly disallow joining at certain troublesome
879 * times (ie. during recovery). */ 879 * times (ie. during recovery). */
880 if (dlm && dlm->dlm_state != DLM_CTXT_LEAVING) { 880 if (dlm->dlm_state != DLM_CTXT_LEAVING) {
881 int bit = query->node_idx; 881 int bit = query->node_idx;
882 spin_lock(&dlm->spinlock); 882 spin_lock(&dlm->spinlock);
883 883
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
index 215e41abf101..3689b3592042 100644
--- a/fs/ocfs2/dlm/dlmmaster.c
+++ b/fs/ocfs2/dlm/dlmmaster.c
@@ -1460,6 +1460,18 @@ way_up_top:
1460 1460
1461 /* take care of the easy cases up front */ 1461 /* take care of the easy cases up front */
1462 spin_lock(&res->spinlock); 1462 spin_lock(&res->spinlock);
1463
1464 /*
1465 * Right after dlm spinlock was released, dlm_thread could have
1466 * purged the lockres. Check if lockres got unhashed. If so
1467 * start over.
1468 */
1469 if (hlist_unhashed(&res->hash_node)) {
1470 spin_unlock(&res->spinlock);
1471 dlm_lockres_put(res);
1472 goto way_up_top;
1473 }
1474
1463 if (res->state & (DLM_LOCK_RES_RECOVERING| 1475 if (res->state & (DLM_LOCK_RES_RECOVERING|
1464 DLM_LOCK_RES_MIGRATING)) { 1476 DLM_LOCK_RES_MIGRATING)) {
1465 spin_unlock(&res->spinlock); 1477 spin_unlock(&res->spinlock);
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c
index 3365839d2971..79b5af5e6a7b 100644
--- a/fs/ocfs2/dlm/dlmrecovery.c
+++ b/fs/ocfs2/dlm/dlmrecovery.c
@@ -1656,14 +1656,18 @@ int dlm_do_master_requery(struct dlm_ctxt *dlm, struct dlm_lock_resource *res,
1656 req.namelen = res->lockname.len; 1656 req.namelen = res->lockname.len;
1657 memcpy(req.name, res->lockname.name, res->lockname.len); 1657 memcpy(req.name, res->lockname.name, res->lockname.len);
1658 1658
1659resend:
1659 ret = o2net_send_message(DLM_MASTER_REQUERY_MSG, dlm->key, 1660 ret = o2net_send_message(DLM_MASTER_REQUERY_MSG, dlm->key,
1660 &req, sizeof(req), nodenum, &status); 1661 &req, sizeof(req), nodenum, &status);
1661 /* XXX: negative status not handled properly here. */
1662 if (ret < 0) 1662 if (ret < 0)
1663 mlog(ML_ERROR, "Error %d when sending message %u (key " 1663 mlog(ML_ERROR, "Error %d when sending message %u (key "
1664 "0x%x) to node %u\n", ret, DLM_MASTER_REQUERY_MSG, 1664 "0x%x) to node %u\n", ret, DLM_MASTER_REQUERY_MSG,
1665 dlm->key, nodenum); 1665 dlm->key, nodenum);
1666 else { 1666 else if (status == -ENOMEM) {
1667 mlog_errno(status);
1668 msleep(50);
1669 goto resend;
1670 } else {
1667 BUG_ON(status < 0); 1671 BUG_ON(status < 0);
1668 BUG_ON(status > DLM_LOCK_RES_OWNER_UNKNOWN); 1672 BUG_ON(status > DLM_LOCK_RES_OWNER_UNKNOWN);
1669 *real_master = (u8) (status & 0xff); 1673 *real_master = (u8) (status & 0xff);
@@ -1705,9 +1709,13 @@ int dlm_master_requery_handler(struct o2net_msg *msg, u32 len, void *data,
1705 int ret = dlm_dispatch_assert_master(dlm, res, 1709 int ret = dlm_dispatch_assert_master(dlm, res,
1706 0, 0, flags); 1710 0, 0, flags);
1707 if (ret < 0) { 1711 if (ret < 0) {
1708 mlog_errno(-ENOMEM); 1712 mlog_errno(ret);
1709 /* retry!? */ 1713 spin_unlock(&res->spinlock);
1710 BUG(); 1714 dlm_lockres_put(res);
1715 spin_unlock(&dlm->spinlock);
1716 dlm_put(dlm);
1717 /* sender will take care of this and retry */
1718 return ret;
1711 } else 1719 } else
1712 __dlm_lockres_grab_inflight_worker(dlm, res); 1720 __dlm_lockres_grab_inflight_worker(dlm, res);
1713 spin_unlock(&res->spinlock); 1721 spin_unlock(&res->spinlock);
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
index 37297c14f9a3..1c423af04c69 100644
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -861,8 +861,13 @@ static inline void ocfs2_generic_handle_convert_action(struct ocfs2_lock_res *lo
861 * We set the OCFS2_LOCK_UPCONVERT_FINISHING flag before clearing 861 * We set the OCFS2_LOCK_UPCONVERT_FINISHING flag before clearing
862 * the OCFS2_LOCK_BUSY flag to prevent the dc thread from 862 * the OCFS2_LOCK_BUSY flag to prevent the dc thread from
863 * downconverting the lock before the upconvert has fully completed. 863 * downconverting the lock before the upconvert has fully completed.
864 * Do not prevent the dc thread from downconverting if NONBLOCK lock
865 * had already returned.
864 */ 866 */
865 lockres_or_flags(lockres, OCFS2_LOCK_UPCONVERT_FINISHING); 867 if (!(lockres->l_flags & OCFS2_LOCK_NONBLOCK_FINISHED))
868 lockres_or_flags(lockres, OCFS2_LOCK_UPCONVERT_FINISHING);
869 else
870 lockres_clear_flags(lockres, OCFS2_LOCK_NONBLOCK_FINISHED);
866 871
867 lockres_clear_flags(lockres, OCFS2_LOCK_BUSY); 872 lockres_clear_flags(lockres, OCFS2_LOCK_BUSY);
868} 873}
@@ -1324,13 +1329,12 @@ static void lockres_add_mask_waiter(struct ocfs2_lock_res *lockres,
1324 1329
1325/* returns 0 if the mw that was removed was already satisfied, -EBUSY 1330/* returns 0 if the mw that was removed was already satisfied, -EBUSY
1326 * if the mask still hadn't reached its goal */ 1331 * if the mask still hadn't reached its goal */
1327static int lockres_remove_mask_waiter(struct ocfs2_lock_res *lockres, 1332static int __lockres_remove_mask_waiter(struct ocfs2_lock_res *lockres,
1328 struct ocfs2_mask_waiter *mw) 1333 struct ocfs2_mask_waiter *mw)
1329{ 1334{
1330 unsigned long flags;
1331 int ret = 0; 1335 int ret = 0;
1332 1336
1333 spin_lock_irqsave(&lockres->l_lock, flags); 1337 assert_spin_locked(&lockres->l_lock);
1334 if (!list_empty(&mw->mw_item)) { 1338 if (!list_empty(&mw->mw_item)) {
1335 if ((lockres->l_flags & mw->mw_mask) != mw->mw_goal) 1339 if ((lockres->l_flags & mw->mw_mask) != mw->mw_goal)
1336 ret = -EBUSY; 1340 ret = -EBUSY;
@@ -1338,6 +1342,18 @@ static int lockres_remove_mask_waiter(struct ocfs2_lock_res *lockres,
1338 list_del_init(&mw->mw_item); 1342 list_del_init(&mw->mw_item);
1339 init_completion(&mw->mw_complete); 1343 init_completion(&mw->mw_complete);
1340 } 1344 }
1345
1346 return ret;
1347}
1348
1349static int lockres_remove_mask_waiter(struct ocfs2_lock_res *lockres,
1350 struct ocfs2_mask_waiter *mw)
1351{
1352 unsigned long flags;
1353 int ret = 0;
1354
1355 spin_lock_irqsave(&lockres->l_lock, flags);
1356 ret = __lockres_remove_mask_waiter(lockres, mw);
1341 spin_unlock_irqrestore(&lockres->l_lock, flags); 1357 spin_unlock_irqrestore(&lockres->l_lock, flags);
1342 1358
1343 return ret; 1359 return ret;
@@ -1373,6 +1389,7 @@ static int __ocfs2_cluster_lock(struct ocfs2_super *osb,
1373 unsigned long flags; 1389 unsigned long flags;
1374 unsigned int gen; 1390 unsigned int gen;
1375 int noqueue_attempted = 0; 1391 int noqueue_attempted = 0;
1392 int dlm_locked = 0;
1376 1393
1377 ocfs2_init_mask_waiter(&mw); 1394 ocfs2_init_mask_waiter(&mw);
1378 1395
@@ -1481,6 +1498,7 @@ again:
1481 ocfs2_recover_from_dlm_error(lockres, 1); 1498 ocfs2_recover_from_dlm_error(lockres, 1);
1482 goto out; 1499 goto out;
1483 } 1500 }
1501 dlm_locked = 1;
1484 1502
1485 mlog(0, "lock %s, successful return from ocfs2_dlm_lock\n", 1503 mlog(0, "lock %s, successful return from ocfs2_dlm_lock\n",
1486 lockres->l_name); 1504 lockres->l_name);
@@ -1514,10 +1532,17 @@ out:
1514 if (wait && arg_flags & OCFS2_LOCK_NONBLOCK && 1532 if (wait && arg_flags & OCFS2_LOCK_NONBLOCK &&
1515 mw.mw_mask & (OCFS2_LOCK_BUSY|OCFS2_LOCK_BLOCKED)) { 1533 mw.mw_mask & (OCFS2_LOCK_BUSY|OCFS2_LOCK_BLOCKED)) {
1516 wait = 0; 1534 wait = 0;
1517 if (lockres_remove_mask_waiter(lockres, &mw)) 1535 spin_lock_irqsave(&lockres->l_lock, flags);
1536 if (__lockres_remove_mask_waiter(lockres, &mw)) {
1537 if (dlm_locked)
1538 lockres_or_flags(lockres,
1539 OCFS2_LOCK_NONBLOCK_FINISHED);
1540 spin_unlock_irqrestore(&lockres->l_lock, flags);
1518 ret = -EAGAIN; 1541 ret = -EAGAIN;
1519 else 1542 } else {
1543 spin_unlock_irqrestore(&lockres->l_lock, flags);
1520 goto again; 1544 goto again;
1545 }
1521 } 1546 }
1522 if (wait) { 1547 if (wait) {
1523 ret = ocfs2_wait_for_mask(&mw); 1548 ret = ocfs2_wait_for_mask(&mw);
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 324dc93ac896..69fb9f75b082 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -2381,9 +2381,7 @@ out_dio:
2381 if (ret < 0) 2381 if (ret < 0)
2382 written = ret; 2382 written = ret;
2383 2383
2384 if (!ret && ((old_size != i_size_read(inode)) || 2384 if (!ret) {
2385 (old_clusters != OCFS2_I(inode)->ip_clusters) ||
2386 has_refcount)) {
2387 ret = jbd2_journal_force_commit(osb->journal->j_journal); 2385 ret = jbd2_journal_force_commit(osb->journal->j_journal);
2388 if (ret < 0) 2386 if (ret < 0)
2389 written = ret; 2387 written = ret;
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index 437de7f768c6..c8b25de9efbb 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -540,8 +540,7 @@ bail:
540 if (status < 0) 540 if (status < 0)
541 make_bad_inode(inode); 541 make_bad_inode(inode);
542 542
543 if (args && bh) 543 brelse(bh);
544 brelse(bh);
545 544
546 return status; 545 return status;
547} 546}
diff --git a/fs/ocfs2/move_extents.c b/fs/ocfs2/move_extents.c
index 74caffeeee1d..56a768d06aa6 100644
--- a/fs/ocfs2/move_extents.c
+++ b/fs/ocfs2/move_extents.c
@@ -904,9 +904,6 @@ static int ocfs2_move_extents(struct ocfs2_move_extents_context *context)
904 struct buffer_head *di_bh = NULL; 904 struct buffer_head *di_bh = NULL;
905 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 905 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
906 906
907 if (!inode)
908 return -ENOENT;
909
910 if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb)) 907 if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb))
911 return -EROFS; 908 return -EROFS;
912 909
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
index bbec539230fd..7d6b7d090452 100644
--- a/fs/ocfs2/ocfs2.h
+++ b/fs/ocfs2/ocfs2.h
@@ -144,6 +144,12 @@ enum ocfs2_unlock_action {
144 * before the upconvert 144 * before the upconvert
145 * has completed */ 145 * has completed */
146 146
147#define OCFS2_LOCK_NONBLOCK_FINISHED (0x00001000) /* NONBLOCK cluster
148 * lock has already
149 * returned, do not block
150 * dc thread from
151 * downconverting */
152
147struct ocfs2_lock_res_ops; 153struct ocfs2_lock_res_ops;
148 154
149typedef void (*ocfs2_lock_callback)(int status, unsigned long data); 155typedef void (*ocfs2_lock_callback)(int status, unsigned long data);
diff --git a/fs/ocfs2/slot_map.c b/fs/ocfs2/slot_map.c
index a88b2a4fcc85..d5493e361a38 100644
--- a/fs/ocfs2/slot_map.c
+++ b/fs/ocfs2/slot_map.c
@@ -306,7 +306,7 @@ int ocfs2_slot_to_node_num_locked(struct ocfs2_super *osb, int slot_num,
306 assert_spin_locked(&osb->osb_lock); 306 assert_spin_locked(&osb->osb_lock);
307 307
308 BUG_ON(slot_num < 0); 308 BUG_ON(slot_num < 0);
309 BUG_ON(slot_num > osb->max_slots); 309 BUG_ON(slot_num >= osb->max_slots);
310 310
311 if (!si->si_slots[slot_num].sl_valid) 311 if (!si->si_slots[slot_num].sl_valid)
312 return -ENOENT; 312 return -ENOENT;
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index 0945814ddb7b..83723179e1ec 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -1629,8 +1629,9 @@ static int __init ocfs2_init(void)
1629 1629
1630 ocfs2_debugfs_root = debugfs_create_dir("ocfs2", NULL); 1630 ocfs2_debugfs_root = debugfs_create_dir("ocfs2", NULL);
1631 if (!ocfs2_debugfs_root) { 1631 if (!ocfs2_debugfs_root) {
1632 status = -EFAULT; 1632 status = -ENOMEM;
1633 mlog(ML_ERROR, "Unable to create ocfs2 debugfs root.\n"); 1633 mlog(ML_ERROR, "Unable to create ocfs2 debugfs root.\n");
1634 goto out4;
1634 } 1635 }
1635 1636
1636 ocfs2_set_locking_protocol(); 1637 ocfs2_set_locking_protocol();
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index 016f01df3825..662f8dee149f 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -1284,7 +1284,7 @@ int ocfs2_xattr_get_nolock(struct inode *inode,
1284 return -EOPNOTSUPP; 1284 return -EOPNOTSUPP;
1285 1285
1286 if (!(oi->ip_dyn_features & OCFS2_HAS_XATTR_FL)) 1286 if (!(oi->ip_dyn_features & OCFS2_HAS_XATTR_FL))
1287 ret = -ENODATA; 1287 return -ENODATA;
1288 1288
1289 xis.inode_bh = xbs.inode_bh = di_bh; 1289 xis.inode_bh = xbs.inode_bh = di_bh;
1290 di = (struct ocfs2_dinode *)di_bh->b_data; 1290 di = (struct ocfs2_dinode *)di_bh->b_data;