From 03089e7b1f36aee8865aac627f8d8b037bd2658b Mon Sep 17 00:00:00 2001 From: rread Date: Wed, 7 May 2003 09:12:44 +0000 Subject: [PATCH] r=phil@clusterfs.com - protect the obd_exports list with obd_lock - get a reference on the export from the list - and release the reference when done. --- lustre/obdclass/statfs_pack.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lustre/obdclass/statfs_pack.c b/lustre/obdclass/statfs_pack.c index a86f017..1a5f6fa 100644 --- a/lustre/obdclass/statfs_pack.c +++ b/lustre/obdclass/statfs_pack.c @@ -72,13 +72,19 @@ int obd_self_statfs(struct obd_device *obd, struct statfs *sfs) int rc; ENTRY; + LASSERT( obd != NULL ); + + spin_lock(&obd->obd_dev_lock); if (list_empty(&obd->obd_exports)) { + spin_unlock(&obd->obd_dev_lock); export = my_export = class_new_export(obd); if (export == NULL) RETURN(-ENOMEM); } else { export = list_entry(obd->obd_exports.next, typeof(*export), exp_obd_chain); + export = class_export_get(export); + spin_unlock(&obd->obd_dev_lock); } conn.cookie = export->exp_handle.h_cookie; @@ -88,6 +94,8 @@ int obd_self_statfs(struct obd_device *obd, struct statfs *sfs) if (my_export) class_unlink_export(my_export); + + class_export_put(export); RETURN(rc); } -- 1.8.3.1