#ifdef HAVE_SERVER_SUPPORT
ssize_t num_exports_show(struct kobject *kobj, struct attribute *attr,
char *buf);
+ssize_t grant_check_threshold_show(struct kobject *kobj,
+ struct attribute *attr, char *buf);
+ssize_t grant_check_threshold_store(struct kobject *kobj,
+ struct attribute *attr,
+ const char *buffer, size_t count);
#endif
struct adaptive_timeout;
extern int lprocfs_at_hist_helper(struct seq_file *m,
struct list_head obd_lwp_list;
atomic_t obd_refcount;
int obd_num_exports;
+ int obd_grant_check_threshold;
spinlock_t obd_nid_lock;
struct ldlm_namespace *obd_namespace;
struct ptlrpc_client obd_ldlm_client; /* XXX OST/MDS only */
LUSTRE_RO_ATTR(instance);
LUSTRE_RO_ATTR(num_exports);
+LUSTRE_RW_ATTR(grant_check_threshold);
static struct attribute *mdt_attrs[] = {
&lustre_attr_tot_dirty.attr,
&lustre_attr_recovery_time_soft.attr,
&lustre_attr_ir_factor.attr,
&lustre_attr_num_exports.attr,
+ &lustre_attr_grant_check_threshold.attr,
&lustre_attr_identity_expire.attr,
&lustre_attr_identity_acquire_expire.attr,
&lustre_attr_identity_upcall.attr,
newdev->obd_pool_slv = 0;
INIT_LIST_HEAD(&newdev->obd_exports);
+ newdev->obd_num_exports = 0;
+ newdev->obd_grant_check_threshold = 100;
INIT_LIST_HEAD(&newdev->obd_unlinked_exports);
INIT_LIST_HEAD(&newdev->obd_delayed_exports);
INIT_LIST_HEAD(&newdev->obd_exports_timed);
}
EXPORT_SYMBOL(num_exports_show);
+ssize_t grant_check_threshold_show(struct kobject *kobj, struct attribute *attr,
+ char *buf)
+{
+ struct obd_device *obd = container_of(kobj, struct obd_device,
+ obd_kset.kobj);
+
+ return scnprintf(buf, PAGE_SIZE, "%d\n",
+ obd->obd_grant_check_threshold);
+}
+EXPORT_SYMBOL(grant_check_threshold_show);
+
+ssize_t grant_check_threshold_store(struct kobject *kobj,
+ struct attribute *attr,
+ const char *buffer, size_t count)
+{
+ struct obd_device *obd = container_of(kobj, struct obd_device,
+ obd_kset.kobj);
+ int val;
+ int rc;
+
+ rc = kstrtoint(buffer, 10, &val);
+ if (rc)
+ return rc;
+
+ if (val < 0)
+ return -EINVAL;
+ obd->obd_grant_check_threshold = val;
+ return count;
+}
+EXPORT_SYMBOL(grant_check_threshold_store);
+
static int obd_export_flags2str(struct obd_export *exp, struct seq_file *m)
{
bool first = true;
LUSTRE_RO_ATTR(instance);
LUSTRE_RO_ATTR(num_exports);
+LUSTRE_RW_ATTR(grant_check_threshold);
struct lprocfs_vars lprocfs_ofd_obd_vars[] = {
{ .name = "last_id",
&lustre_attr_recovery_time_soft.attr,
&lustre_attr_ir_factor.attr,
&lustre_attr_num_exports.attr,
+ &lustre_attr_grant_check_threshold.attr,
&lustre_attr_seqs_allocated.attr,
&lustre_attr_grant_precreate.attr,
&lustre_attr_precreate_batch.attr,
* argument. LBUG is only called in case of serious counter corruption (i.e.
* value larger than the device size).
* Those sanity checks can be pretty expensive and are disabled if the OBD
- * device has more than 100 connected exports.
+ * device has more than 100 connected exports by default.
*
* \param[in] obd OBD device for which grant accounting should be
* verified
if (list_empty(&obd->obd_exports))
return;
- /* We don't want to do this for large machines that do lots of
- * mounts or unmounts. It burns... */
- if (obd->obd_num_exports > 100)
+ /*
+ * We don't want to do this for large machines that do lots of
+ * mounts or unmounts. It burns...
+ * Use set_param to change obd_grant_check_threshold, which
+ * is 100 by default, 0 to always check grants
+ */
+ if (obd->obd_num_exports > obd->obd_grant_check_threshold &&
+ obd->obd_grant_check_threshold)
return;
maxsize = tgd->tgd_osfs.os_blocks << tgd->tgd_blockbits;