From f87ed620fb775a7ee2479ee232b09d5509c62b2d Mon Sep 17 00:00:00 2001 From: yury Date: Sat, 9 Dec 2006 10:56:07 +0000 Subject: [PATCH] - cleanups in ll_drop_dentry(), some other cleanups; - fix from 1_5 branch in ldlm_lock_cancel(). There was race possible when we ask client to return lock back and client does it by itself. --- lustre/ldlm/ldlm_lib.c | 6 +++--- lustre/ldlm/ldlm_lock.c | 10 +++++++--- lustre/llite/dcache.c | 11 +++-------- lustre/mdt/mdt_handler.c | 8 +++----- 4 files changed, 16 insertions(+), 19 deletions(-) diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index 04ad1f6..1740f47 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -1370,8 +1370,8 @@ static int target_recovery_thread(void *arg) /* If some clients haven't connected in time, evict them */ if (obd->obd_abort_recovery) { int stale; - CDEBUG(D_ERROR, "few clients haven't connect in time (%d/%d)," - "evict them ...\n", obd->obd_connected_clients, + CDEBUG(D_ERROR, "Some clients haven't connect in time (%d/%d)," + "evict them\n", obd->obd_connected_clients, obd->obd_max_recoverable_clients); obd->obd_abort_recovery = 0; stale = class_disconnect_stale_exports(obd, connect_done); @@ -1511,7 +1511,7 @@ void target_stop_recovery_thread(struct obd_device *obd) spin_lock_bh(&obd->obd_processing_task_lock); if (obd->obd_recovery_data.trd_processing_task > 0) { struct target_recovery_data *trd = &obd->obd_recovery_data; - CERROR("%s: aborting recovery\n", obd->obd_name); + CERROR("%s: Aborting recovery\n", obd->obd_name); obd->obd_abort_recovery = 1; wake_up(&obd->obd_next_transno_waitq); spin_unlock_bh(&obd->obd_processing_task_lock); diff --git a/lustre/ldlm/ldlm_lock.c b/lustre/ldlm/ldlm_lock.c index 78f7474..0d9a991 100644 --- a/lustre/ldlm/ldlm_lock.c +++ b/lustre/ldlm/ldlm_lock.c @@ -1209,7 +1209,6 @@ void ldlm_lock_cancel(struct ldlm_lock *lock) struct ldlm_namespace *ns; ENTRY; - ldlm_del_waiting_lock(lock); lock_res_and_lock(lock); res = lock->l_resource; @@ -1222,13 +1221,18 @@ void ldlm_lock_cancel(struct ldlm_lock *lock) LBUG(); } + ldlm_del_waiting_lock(lock); + + /* Releases cancel callback. */ ldlm_cancel_callback(lock); + /* Yes, second time, just in case it was added again while we were + * running with no res lock in ldlm_cancel_callback */ + ldlm_del_waiting_lock(lock); ldlm_resource_unlink_lock(lock); + ldlm_lock_destroy_nolock(lock); unlock_res_and_lock(lock); - ldlm_lock_destroy(lock); - EXIT; } diff --git a/lustre/llite/dcache.c b/lustre/llite/dcache.c index 09f635e..352dec9 100644 --- a/lustre/llite/dcache.c +++ b/lustre/llite/dcache.c @@ -202,14 +202,6 @@ int ll_drop_dentry(struct dentry *dentry) * sys_getcwd() could return -ENOENT -bzzz */ #ifdef LUSTRE_KERNEL_VERSION dentry->d_flags |= DCACHE_LUSTRE_INVALID; - - /* - * XXX: Try to drop negative not directory dentries to check if - * this is source of OOM on clients on big numbers of created - * files. --umka - */ - if (!dentry->d_inode || !S_ISDIR(dentry->d_inode->i_mode)) - __d_drop(dentry); #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) __d_drop(dentry); if (dentry->d_inode) { @@ -217,6 +209,9 @@ int ll_drop_dentry(struct dentry *dentry) list_add(&dentry->d_hash, &ll_i2sbi(dentry->d_inode)->ll_orphan_dentry_list); } +#else + if (!dentry->d_inode || !S_ISDIR(dentry->d_inode->i_mode)) + __d_drop(dentry); #endif #else if (!dentry->d_inode || !S_ISDIR(dentry->d_inode->i_mode)) diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index a9d9cdf..c829e5e 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -4239,19 +4239,17 @@ static int mdt_iocontrol(unsigned int cmd, struct obd_export *exp, int len, case OBD_IOC_SYNC: rc = dt->dd_ops->dt_sync(&env, dt); break; - case OBD_IOC_SET_READONLY: rc = dt->dd_ops->dt_sync(&env, dt); dt->dd_ops->dt_ro(&env, dt); break; - case OBD_IOC_ABORT_RECOVERY: - CERROR("aborting recovery for device %s\n", obd->obd_name); + CERROR("Aborting recovery for device %s\n", obd->obd_name); target_stop_recovery_thread(obd); + rc = 0; break; - default: - CERROR("not supported cmd = %d for device %s\n", + CERROR("Not supported cmd = %d for device %s\n", cmd, obd->obd_name); rc = -EOPNOTSUPP; } -- 1.8.3.1