obd_abort_recovery:1, /* recovery expired */
obd_version_recov:1, /* obd uses version checking */
obd_replayable:1, /* recovery enabled; inform clients */
- obd_no_transno:1, /* no committed-transno notification */
obd_no_recov:1, /* fail instead of retry messages */
obd_stopping:1, /* started cleanup */
obd_starting:1, /* started setup */
obd_no_ir:1, /* no imperative recovery. */
obd_process_conf:1, /* device is processing mgs config */
obd_checksum_dump:1; /* dump pages upon cksum error */
+#ifdef HAVE_SERVER_SUPPORT
+ /* no committed-transno notification */
+ unsigned long obd_no_transno:1;
+#endif
/* use separate field as it is set in interrupt to don't mess with
* protection of other bits using _bh lock */
/* was OBD_IOC_PING_TARGET _IOW('f', 136, OBD_IOC_DATA_TYPE) until 2.11 */
/* OBD_IOC_DEC_FS_USE_COUNT _IO('f', 139) */
-#define OBD_IOC_NO_TRANSNO _IOW('f', 140, OBD_IOC_DATA_TYPE)
+/* was OBD_IOC_NO_TRANSNO _IOW('f', 140, OBD_IOC_DATA_TYPE) until 2.14 */
#define OBD_IOC_SET_READONLY _IOW('f', 141, OBD_IOC_DATA_TYPE)
#define OBD_IOC_ABORT_RECOVERY _IOR('f', 142, OBD_IOC_DATA_TYPE)
/* OBD_IOC_ROOT_SQUASH _IOWR('f', 143, OBD_IOC_DATA_TYPE) */
GOTO(out, err = -EINVAL);
}
- switch(cmd) {
- case OBD_IOC_NO_TRANSNO: {
- if (!obd->obd_attached) {
- CERROR("Device %d not attached\n", obd->obd_minor);
- GOTO(out, err = -ENODEV);
- }
- CDEBUG(D_HA, "%s: disabling committed-transno notification\n",
- obd->obd_name);
- obd->obd_no_transno = 1;
- GOTO(out, err = 0);
- }
-
- default: {
- err = obd_iocontrol(cmd, obd->obd_self_export, len, data, NULL);
- if (err)
- GOTO(out, err);
-
- if (copy_to_user((void __user *)arg, data, len))
- err = -EFAULT;
- GOTO(out, err);
- }
- }
+ err = obd_iocontrol(cmd, obd->obd_self_export, len, data, NULL);
+ if (err)
+ GOTO(out, err);
+ if (copy_to_user((void __user *)arg, data, len))
+ err = -EFAULT;
out:
OBD_FREE_LARGE(buf, len);
RETURN(err);
case 'A':
LCONSOLE_WARN("Failing over %s\n",
obd->obd_name);
+ spin_lock(&obd->obd_dev_lock);
obd->obd_fail = 1;
+#ifdef HAVE_SERVER_SUPPORT
obd->obd_no_transno = 1;
+#endif
obd->obd_no_recov = 1;
+ spin_unlock(&obd->obd_dev_lock);
if (OBP(obd, iocontrol)) {
obd_iocontrol(OBD_IOC_SYNC,
obd->obd_self_export,
}
LUSTRE_RW_ATTR(max_dirty_mb);
+#ifdef HAVE_SERVER_SUPPORT
+static ssize_t no_transno_store(struct kobject *kobj,
+ struct attribute *attr,
+ const char *buffer, size_t count)
+{
+ struct obd_device *obd;
+ unsigned int idx;
+ int rc;
+
+ rc = kstrtouint(buffer, 10, &idx);
+ if (rc)
+ return rc;
+
+ obd = class_num2obd(idx);
+ if (!obd || !obd->obd_attached) {
+ if (obd)
+ CERROR("%s: not attached\n", obd->obd_name);
+ return -ENODEV;
+ }
+
+ spin_lock(&obd->obd_dev_lock);
+ obd->obd_no_transno = 1;
+ spin_unlock(&obd->obd_dev_lock);
+ return count;
+}
+LUSTRE_WO_ATTR(no_transno);
+#endif /* HAVE_SERVER_SUPPORT */
+
static ssize_t version_show(struct kobject *kobj, struct attribute *attr,
char *buf)
{
#ifdef HAVE_SERVER_SUPPORT
&lustre_sattr_ldlm_timeout.u.attr,
&lustre_sattr_bulk_timeout.u.attr,
+ &lustre_attr_no_transno.attr,
#endif
&lustre_sattr_lbug_on_eviction.u.attr,
NULL,
"usage: lookup <directory> <file>"},
{"readonly", jt_obd_set_readonly, 0,
"disable writes to the underlying device\n"},
+#ifdef HAVE_SERVER_SUPPORT
{"notransno", jt_obd_no_transno, 0,
"disable sending of committed-transno updates\n"},
+#endif
{"add_uuid", jt_lcfg_add_uuid, 0, "associate a UUID with a NID\n"
"usage: add_uuid <uuid> <nid>"},
{"del_uuid", jt_lcfg_del_uuid, 0, "delete a UUID association\n"
return rc;
}
+#ifdef HAVE_SERVER_SUPPORT
+/* Place this here so we can build tools that work with
+ * older Lustre versions
+ */
+#ifndef OBD_IOC_NO_TRANSNO
+#define OBD_IOC_NO_TRANSNO _IOW('f', 140, OBD_IOC_DATA_TYPE)
+#endif
+
int jt_obd_no_transno(int argc, char **argv)
{
struct obd_ioctl_data data;
char rawbuf[MAX_IOC_BUFLEN], *buf = rawbuf;
+ glob_t path;
+ int count;
+ int fd;
int rc;
- memset(&data, 0, sizeof(data));
- data.ioc_dev = cur_device;
-
if (argc != 1)
return CMD_HELP;
memset(buf, 0, sizeof(rawbuf));
+
+ rc = cfs_get_param_paths(&path, "no_transno");
+ if (rc != 0)
+ goto old_ioctl;
+
+ fd = open(path.gl_pathv[0], O_WRONLY);
+ if (fd < 0) {
+ cfs_free_param_data(&path);
+ goto old_ioctl;
+ }
+
+ snprintf(rawbuf, sizeof(rawbuf), "%d", cur_device);
+
+ count = write(fd, rawbuf, strlen(rawbuf));
+ if (count < 0)
+ rc = errno;
+
+ cfs_free_param_data(&path);
+ close(fd);
+ if (rc)
+ goto old_ioctl;
+
+ return 0;
+
+old_ioctl:
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 0, 53, 0)
+ memset(&data, 0, sizeof(data));
+ data.ioc_dev = cur_device;
+
rc = llapi_ioctl_pack(&data, &buf, sizeof(rawbuf));
if (rc) {
fprintf(stderr, "error: %s: invalid ioctl\n",
if (rc < 0)
fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]),
strerror(rc = errno));
-
+#endif
return rc;
}
+#endif /* HAVE_SERVER_SUPPORT */
int jt_obd_set_readonly(int argc, char **argv)
{