From 092bc367739b954a056d95290b265e94264c899f Mon Sep 17 00:00:00 2001 From: zab <zab> Date: Fri, 5 Dec 2003 20:28:01 +0000 Subject: [PATCH] b=2330 minor state cleanup from matching error return paths --- lustre/llite/file.c | 14 ++++++++------ lustre/llite/rw.c | 2 ++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 06467e38ce..bd573aad8d 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -490,10 +490,8 @@ int ll_extent_lock(struct ll_file_data *fd, struct inode *inode, RETURN(0); rc = ll_lsm_getattr(exp, lsm, &oa); - if (rc) { - ll_extent_unlock(fd, inode, lsm, mode, lockh); - RETURN(rc); - } + if (rc) + GOTO(out, rc); /* We set this flag in commit write as we extend the file size. When * the bit is set and the lock is canceled that covers the file size, @@ -528,7 +526,7 @@ int ll_extent_lock(struct ll_file_data *fd, struct inode *inode, sizeof(size_lock), LCK_PR, &flags, inode, &match_lockh); if (matched < 0) - RETURN(matched); + GOTO(out, rc = matched); /* hey, alright, we hold a size lock that covers the size we * just found, its not going to change for a while.. */ @@ -537,7 +535,11 @@ int ll_extent_lock(struct ll_file_data *fd, struct inode *inode, obd_cancel(exp, lsm, LCK_PR, &match_lockh); } - RETURN(0); + rc = 0; +out: + if (rc) + ll_extent_unlock(fd, inode, lsm, mode, lockh); + RETURN(rc); } int ll_extent_unlock(struct ll_file_data *fd, struct inode *inode, diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c index 697068371c..b8ff805001 100644 --- a/lustre/llite/rw.c +++ b/lustre/llite/rw.c @@ -559,6 +559,8 @@ static void ll_start_readahead(struct obd_export *exp, struct inode *inode, &flags, inode, &match_lockh); if (matched < 0) { LL_CDEBUG_PAGE(page, "lock match failed\n"); + unlock_page(page); + page_cache_release(page); break; } if (matched == 0) { -- GitLab