From 5b1fc417846f3fbf8df7806ee679748fb0bb2f88 Mon Sep 17 00:00:00 2001 From: phil Date: Sat, 5 Feb 2005 06:34:04 +0000 Subject: [PATCH] b=5492 Back out the KMS locking change; I saw a problem with it yesterday, and the new truncate buffalo failures confirmed my suspicion. --- lustre/ChangeLog | 1 - lustre/include/linux/lustre_lite.h | 2 +- lustre/liblustre/rw.c | 4 +--- lustre/llite/file.c | 13 +++++-------- lustre/llite/rw.c | 2 -- lustre/llite/rw24.c | 5 +---- 6 files changed, 8 insertions(+), 19 deletions(-) diff --git a/lustre/ChangeLog b/lustre/ChangeLog index ee1de1d..0fec309 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -17,7 +17,6 @@ tbd Cluster File Systems, Inc. - use "int" for stripe value returned from lock_to_stripe (5544) - mballoc allocation and error-checking fixes in 2.6 (5504) - block device patches to fix I/O request sizes in 2.6 (5482) - - protect KMS changes with its own lock, not i_sem (5492, 5624, 3453) - look up hostnames for IB nals (5602) - 2.6 changed lock ordering of 2 semaphores, caused deadlock (5654) * miscellania diff --git a/lustre/include/linux/lustre_lite.h b/lustre/include/linux/lustre_lite.h index 58b1053..b2adffd 100644 --- a/lustre/include/linux/lustre_lite.h +++ b/lustre/include/linux/lustre_lite.h @@ -76,7 +76,7 @@ struct ll_inode_info { __u64 lli_io_epoch; unsigned long lli_flags; - /* this lock protects s_d_w, p_w_ll, and the KMS */ + /* this lock protects s_d_w and p_w_ll */ spinlock_t lli_lock; int lli_send_done_writing; struct list_head lli_pending_write_llaps; diff --git a/lustre/liblustre/rw.c b/lustre/liblustre/rw.c index b1ec827..a59dba0 100644 --- a/lustre/liblustre/rw.c +++ b/lustre/liblustre/rw.c @@ -113,15 +113,13 @@ static int llu_extent_lock_callback(struct ldlm_lock *lock, stripe = llu_lock_to_stripe_offset(inode, lock); l_lock(&lock->l_resource->lr_namespace->ns_lock); - kms = ldlm_extent_shift_kms(lock, lsm->lsm_oinfo[stripe].loi_kms); + l_unlock(&lock->l_resource->lr_namespace->ns_lock); if (lsm->lsm_oinfo[stripe].loi_kms != kms) LDLM_DEBUG(lock, "updating kms from "LPU64" to "LPU64, lsm->lsm_oinfo[stripe].loi_kms, kms); lsm->lsm_oinfo[stripe].loi_kms = kms; - - l_unlock(&lock->l_resource->lr_namespace->ns_lock); iput: I_RELE(inode); break; diff --git a/lustre/llite/file.c b/lustre/llite/file.c index f438313..daf9669 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -496,18 +496,17 @@ static int ll_extent_lock_callback(struct ldlm_lock *lock, * lock hold times should be very short as ast processing * requires them and has a short timeout. so, i_sem before ns * lock.*/ + down(&inode->i_sem); l_lock(&lock->l_resource->lr_namespace->ns_lock); - spin_lock(&lli->lli_lock); - kms = ldlm_extent_shift_kms(lock, lsm->lsm_oinfo[stripe].loi_kms); + if (lsm->lsm_oinfo[stripe].loi_kms != kms) LDLM_DEBUG(lock, "updating kms from "LPU64" to "LPU64, lsm->lsm_oinfo[stripe].loi_kms, kms); lsm->lsm_oinfo[stripe].loi_kms = kms; - - spin_unlock(&lli->lli_lock); l_unlock(&lock->l_resource->lr_namespace->ns_lock); + up(&inode->i_sem); //ll_try_done_writing(inode); iput: iput(inode); @@ -554,16 +553,14 @@ int ll_async_completion_ast(struct ldlm_lock *lock, int flags, void *data) lsm->lsm_oinfo[stripe].loi_rss = lvb->lvb_size; l_lock(&lock->l_resource->lr_namespace->ns_lock); - spin_lock(&lli->lli_lock); - + down(&inode->i_sem); kms = MAX(lsm->lsm_oinfo[stripe].loi_kms, lvb->lvb_size); kms = ldlm_extent_shift_kms(NULL, kms); if (lsm->lsm_oinfo[stripe].loi_kms != kms) LDLM_DEBUG(lock, "updating kms from "LPU64" to "LPU64, lsm->lsm_oinfo[stripe].loi_kms, kms); lsm->lsm_oinfo[stripe].loi_kms = kms; - - spin_unlock(&lli->lli_lock); + up(&inode->i_sem); l_unlock(&lock->l_resource->lr_namespace->ns_lock); } diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c index 490b0b1..6b68ea5 100644 --- a/lustre/llite/rw.c +++ b/lustre/llite/rw.c @@ -642,9 +642,7 @@ int ll_commit_write(struct file *file, struct page *page, unsigned from, out: size = (((obd_off)page->index) << PAGE_SHIFT) + to; if (rc == 0) { - spin_lock(&lli->lli_lock); obd_increase_kms(exp, lsm, size); - spin_unlock(&lli->lli_lock); if (size > inode->i_size) inode->i_size = size; SetPageUptodate(page); diff --git a/lustre/llite/rw24.c b/lustre/llite/rw24.c index e291d64..6ad6dcd 100644 --- a/lustre/llite/rw24.c +++ b/lustre/llite/rw24.c @@ -176,11 +176,8 @@ static int ll_direct_IO_24(int rw, ptlrpc_set_destroy(set); if (rc == 0) { rc = iobuf->length; - if (rw == WRITE) { - spin_lock(&lli->lli_lock); + if (rw == WRITE) obd_increase_kms(ll_i2obdexp(inode), lsm, offset); - spin_unlock(&lli->lli_lock); - } } OBD_FREE(pga, sizeof(*pga) * iobuf->nr_pages); -- 1.8.3.1