aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2008-01-09 11:37:39 -0500
committerDavid Teigland <teigland@redhat.com>2008-01-30 12:04:42 -0500
commit755b5eb8bac90b35dc901465a06081aaad94e9ae (patch)
tree95fcee45218437aa2fbc17642feece9310f25abe /fs
parent42dc1601a9a31e8da767a4a9c37bad844b3698ab (diff)
dlm: limit dir lookup loop
In a rare case we may need to repeat a local resource directory lookup due to a race with removing the rsb and removing the resdir record. We'll never need to do more than a single additional lookup, though, so the infinite loop around the lookup can be removed. In addition to being unnecessary, the infinite loop is dangerous since some other unknown condition may appear causing the loop to never break. Signed-off-by: David Teigland <teigland@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/dlm/lock.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c
index fa68e9b93651..bc2e4ba4c1be 100644
--- a/fs/dlm/lock.c
+++ b/fs/dlm/lock.c
@@ -1851,7 +1851,7 @@ static void send_blocking_asts_all(struct dlm_rsb *r, struct dlm_lkb *lkb)
1851static int set_master(struct dlm_rsb *r, struct dlm_lkb *lkb) 1851static int set_master(struct dlm_rsb *r, struct dlm_lkb *lkb)
1852{ 1852{
1853 struct dlm_ls *ls = r->res_ls; 1853 struct dlm_ls *ls = r->res_ls;
1854 int error, dir_nodeid, ret_nodeid, our_nodeid = dlm_our_nodeid(); 1854 int i, error, dir_nodeid, ret_nodeid, our_nodeid = dlm_our_nodeid();
1855 1855
1856 if (rsb_flag(r, RSB_MASTER_UNCERTAIN)) { 1856 if (rsb_flag(r, RSB_MASTER_UNCERTAIN)) {
1857 rsb_clear_flag(r, RSB_MASTER_UNCERTAIN); 1857 rsb_clear_flag(r, RSB_MASTER_UNCERTAIN);
@@ -1885,7 +1885,7 @@ static int set_master(struct dlm_rsb *r, struct dlm_lkb *lkb)
1885 return 1; 1885 return 1;
1886 } 1886 }
1887 1887
1888 for (;;) { 1888 for (i = 0; i < 2; i++) {
1889 /* It's possible for dlm_scand to remove an old rsb for 1889 /* It's possible for dlm_scand to remove an old rsb for
1890 this same resource from the toss list, us to create 1890 this same resource from the toss list, us to create
1891 a new one, look up the master locally, and find it 1891 a new one, look up the master locally, and find it
@@ -1899,6 +1899,8 @@ static int set_master(struct dlm_rsb *r, struct dlm_lkb *lkb)
1899 log_debug(ls, "dir_lookup error %d %s", error, r->res_name); 1899 log_debug(ls, "dir_lookup error %d %s", error, r->res_name);
1900 schedule(); 1900 schedule();
1901 } 1901 }
1902 if (error && error != -EEXIST)
1903 return error;
1902 1904
1903 if (ret_nodeid == our_nodeid) { 1905 if (ret_nodeid == our_nodeid) {
1904 r->res_first_lkid = 0; 1906 r->res_first_lkid = 0;