From: shadow Date: Thu, 11 Dec 2008 05:53:14 +0000 (+0000) Subject: client_disconnect_export vs connect request race. X-Git-Tag: v1_9_130~44 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=df78a8e319c5e738d2b1f613382577d3828da8fd;p=fs%2Flustre-release.git client_disconnect_export vs connect request race. if client will evicted at this time - we start invalidate thread without reference to import and import can be freed at same time. Branch HEAD b=17802 i=nathan i=johann --- diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 2e343b0..7976edb 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -13,6 +13,15 @@ tbd Sun Microsystems, Inc. removed cwd "./" (refer to Bugzilla 14399). * File join has been disabled in this release, refer to Bugzilla 16929. +Severity : minor +Frequency : rare +Bugzilla : 17802 +Description: shutdown vs evict race +Details : client_disconnect_export vs connect request race. + if client will evicted at this time - we start invalidate + thread without referece to import and import can be freed + at same time. + Severity : normal Frequency : rare, need acl's on inode. Bugzilla : 16492 diff --git a/lustre/ptlrpc/import.c b/lustre/ptlrpc/import.c index 5021179..08e9f51 100644 --- a/lustre/ptlrpc/import.c +++ b/lustre/ptlrpc/import.c @@ -1185,6 +1185,7 @@ static int signal_completed_replay(struct obd_import *imp) static int ptlrpc_invalidate_import_thread(void *data) { struct obd_import *imp = data; + int disconnect; ENTRY; @@ -1196,6 +1197,13 @@ static int ptlrpc_invalidate_import_thread(void *data) ptlrpc_invalidate_import(imp); + /* is client_disconnect_export in flight ? */ + spin_lock(&imp->imp_lock); + disconnect = imp->imp_deactive; + spin_unlock(&imp->imp_lock); + if (disconnect) + GOTO(out, 0 ); + if (obd_dump_on_eviction) { CERROR("dump the log upon eviction\n"); libcfs_debug_dumplog(); @@ -1204,6 +1212,8 @@ static int ptlrpc_invalidate_import_thread(void *data) IMPORT_SET_STATE(imp, LUSTRE_IMP_RECOVER); ptlrpc_import_recovery_state_machine(imp); +out: + class_import_put(imp); RETURN(0); } #endif @@ -1232,12 +1242,19 @@ int ptlrpc_import_recovery_state_machine(struct obd_import *imp) imp->imp_connection->c_remote_uuid.uuid); #ifdef __KERNEL__ + /* bug 17802: XXX client_disconnect_export vs connect request + * race. if client will evicted at this time, we start invalidate + * thread without referece to import and import can be freed + * at same time. */ + class_import_get(imp); rc = cfs_kernel_thread(ptlrpc_invalidate_import_thread, imp, CLONE_VM | CLONE_FILES); - if (rc < 0) + if (rc < 0) { + class_import_put(imp); CERROR("error starting invalidate thread: %d\n", rc); - else + } else { rc = 0; + } RETURN(rc); #else ptlrpc_invalidate_import(imp);