}
static int mdc_statfs(const struct lu_env *env,
- struct obd_export *exp, struct obd_statfs *osfs,
+ struct obd_export *exp, struct obd_statfs *osfs,
time64_t max_age, __u32 flags)
{
struct obd_device *obd = class_exp2obd(exp);
struct req_format *fmt;
struct ptlrpc_request *req;
struct obd_statfs *msfs;
- struct obd_import *imp = NULL;
+ struct obd_import *imp, *imp0;
int rc;
ENTRY;
- /*
- * Since the request might also come from lprocfs, so we need
- * sync this with client_disconnect_export Bug15684
- */
- down_read(&obd->u.cli.cl_sem);
- if (obd->u.cli.cl_import)
- imp = class_import_get(obd->u.cli.cl_import);
- up_read(&obd->u.cli.cl_sem);
- if (!imp)
- RETURN(-ENODEV);
+ /*
+ * Since the request might also come from lprocfs, so we need
+ * sync this with client_disconnect_export Bug15684
+ */
+ with_imp_locked(obd, imp0, rc)
+ imp = class_import_get(imp0);
+ if (rc)
+ RETURN(rc);
fmt = &RQF_MDS_STATFS;
if ((exp_connect_flags2(exp) & OBD_CONNECT2_SUM_STATFS) &&