From df0aa8fe0083a2dedcd311a2627217fcb88d4b93 Mon Sep 17 00:00:00 2001 From: phil Date: Fri, 5 Dec 2003 05:33:12 +0000 Subject: [PATCH] b=2330 Be more careful about the return codes from obd_match, lest we try to cancel a lock which was never granted. --- lustre/ChangeLog | 1 + lustre/llite/file.c | 2 ++ lustre/llite/rw.c | 12 +++++++++--- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 2bb4fd2..acfb8c2 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -20,6 +20,7 @@ tbd Cluster File Systems, Inc. - fix i_sem/journal inversion in fsfilt_ext3_write_record (2306) - protect MDS inode fsdata with stronger locking (2313) - better error messages when a client is rejected during recovery (1505) + - avoid cancelling locks which were never granted, after failure (2330) * miscellania - allow configurable automake binary, for testing new versions - small update to the lfs documentation diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 8035fee..06467e3 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -527,6 +527,8 @@ int ll_extent_lock(struct ll_file_data *fd, struct inode *inode, matched = obd_match(exp, lsm, LDLM_EXTENT, &size_lock, sizeof(size_lock), LCK_PR, &flags, inode, &match_lockh); + if (matched < 0) + RETURN(matched); /* hey, alright, we hold a size lock that covers the size we * just found, its not going to change for a while.. */ diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c index eb940cd..6970683 100644 --- a/lustre/llite/rw.c +++ b/lustre/llite/rw.c @@ -557,7 +557,11 @@ static void ll_start_readahead(struct obd_export *exp, struct inode *inode, ll_i2info(inode)->lli_smd, LDLM_EXTENT, &page_extent, sizeof(page_extent), LCK_PR, &flags, inode, &match_lockh); - if (!matched) { + if (matched < 0) { + LL_CDEBUG_PAGE(page, "lock match failed\n"); + break; + } + if (matched == 0) { LL_CDEBUG_PAGE(page, "didn't match a lock\n"); unlock_page(page); page_cache_release(page); @@ -625,8 +629,10 @@ int ll_readpage(struct file *file, struct page *page) matched = obd_match(sbi->ll_osc_exp, ll_i2info(inode)->lli_smd, LDLM_EXTENT, &page_extent, sizeof(page_extent), LCK_PR, &flags, inode, &match_lockh); + if (matched < 0) + GOTO(out, rc = matched); - if (!matched) { + if (matched == 0) { static unsigned long next_print; CDEBUG(D_INODE, "didn't match a lock"); if (time_after(jiffies, next_print)) { @@ -640,7 +646,7 @@ int ll_readpage(struct file *file, struct page *page) if (rc == 0 && (sbi->ll_flags & LL_SBI_READAHEAD)) ll_start_readahead(exp, inode, page->index); - if (matched) + if (matched == 1) obd_cancel(ll_i2sbi(inode)->ll_osc_exp, ll_i2info(inode)->lli_smd, LCK_PR, &match_lockh); out: -- 1.8.3.1