aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei Yongjun <weiyongjun1@huawei.com>2016-08-21 10:42:25 -0400
committerShaohua Li <shli@fb.com>2016-08-24 13:21:51 -0400
commit0f6187dbe542d71ace8ba0908954b0f4f8a30a1e (patch)
treea9e84cc8f54f63bd10c34450d375b83cbd227c0e
parent486b0f7bcd64be027535811ef44195bc1027fbd3 (diff)
md-cluster: fix error return code in join()
Fix to return error code -ENOMEM from the lockres_init() error handling case instead of 0, as done elsewhere in this function. Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: Shaohua Li <shli@fb.com>
-rw-r--r--drivers/md/md-cluster.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c
index 41573f1f626f..34a840d9df76 100644
--- a/drivers/md/md-cluster.c
+++ b/drivers/md/md-cluster.c
@@ -834,8 +834,10 @@ static int join(struct mddev *mddev, int nodes)
834 goto err; 834 goto err;
835 } 835 }
836 cinfo->ack_lockres = lockres_init(mddev, "ack", ack_bast, 0); 836 cinfo->ack_lockres = lockres_init(mddev, "ack", ack_bast, 0);
837 if (!cinfo->ack_lockres) 837 if (!cinfo->ack_lockres) {
838 ret = -ENOMEM;
838 goto err; 839 goto err;
840 }
839 /* get sync CR lock on ACK. */ 841 /* get sync CR lock on ACK. */
840 if (dlm_lock_sync(cinfo->ack_lockres, DLM_LOCK_CR)) 842 if (dlm_lock_sync(cinfo->ack_lockres, DLM_LOCK_CR))
841 pr_err("md-cluster: failed to get a sync CR lock on ACK!(%d)\n", 843 pr_err("md-cluster: failed to get a sync CR lock on ACK!(%d)\n",
@@ -849,8 +851,10 @@ static int join(struct mddev *mddev, int nodes)
849 pr_info("md-cluster: Joined cluster %s slot %d\n", str, cinfo->slot_number); 851 pr_info("md-cluster: Joined cluster %s slot %d\n", str, cinfo->slot_number);
850 snprintf(str, 64, "bitmap%04d", cinfo->slot_number - 1); 852 snprintf(str, 64, "bitmap%04d", cinfo->slot_number - 1);
851 cinfo->bitmap_lockres = lockres_init(mddev, str, NULL, 1); 853 cinfo->bitmap_lockres = lockres_init(mddev, str, NULL, 1);
852 if (!cinfo->bitmap_lockres) 854 if (!cinfo->bitmap_lockres) {
855 ret = -ENOMEM;
853 goto err; 856 goto err;
857 }
854 if (dlm_lock_sync(cinfo->bitmap_lockres, DLM_LOCK_PW)) { 858 if (dlm_lock_sync(cinfo->bitmap_lockres, DLM_LOCK_PW)) {
855 pr_err("Failed to get bitmap lock\n"); 859 pr_err("Failed to get bitmap lock\n");
856 ret = -EINVAL; 860 ret = -EINVAL;
@@ -858,8 +862,10 @@ static int join(struct mddev *mddev, int nodes)
858 } 862 }
859 863
860 cinfo->resync_lockres = lockres_init(mddev, "resync", NULL, 0); 864 cinfo->resync_lockres = lockres_init(mddev, "resync", NULL, 0);
861 if (!cinfo->resync_lockres) 865 if (!cinfo->resync_lockres) {
866 ret = -ENOMEM;
862 goto err; 867 goto err;
868 }
863 869
864 return 0; 870 return 0;
865err: 871err: