Message ID | 1539543498-29105-21-git-send-email-jsimmons@infradead.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | lustre: more assorted fixes for lustre 2.10 | expand |
On Sun, Oct 14 2018, James Simmons wrote: > > + if (!warned) { > + warned = true; > + CWARN("%s: ioctl(OBD_GET_VERSION) is deprecated, use llapi_get_version_string() and/or relink\n", > + current->comm); > + } Is there a good reason not to use WARN_ON_ONCE() here? Thanks, NeilBrown
> On Sun, Oct 14 2018, James Simmons wrote: > > > > + if (!warned) { > > + warned = true; > > + CWARN("%s: ioctl(OBD_GET_VERSION) is deprecated, use llapi_get_version_string() and/or relink\n", > > + current->comm); > > + } > > Is there a good reason not to use WARN_ON_ONCE() here? Oh that is much nicer. Didn't know about it. Shall I submit a new patch or will it be changed when applied to lustre-testing?
On Sat, Oct 20 2018, James Simmons wrote: >> On Sun, Oct 14 2018, James Simmons wrote: >> > >> > + if (!warned) { >> > + warned = true; >> > + CWARN("%s: ioctl(OBD_GET_VERSION) is deprecated, use llapi_get_version_string() and/or relink\n", >> > + current->comm); >> > + } >> >> Is there a good reason not to use WARN_ON_ONCE() here? > > Oh that is much nicer. Didn't know about it. Shall I submit a new > patch or will it be changed when applied to lustre-testing? I've made the change directly - no need to resubmit. Thanks, NeilBrown
diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c b/drivers/staging/lustre/lustre/obdclass/class_obd.c index 2103d2a..c4d820a 100644 --- a/drivers/staging/lustre/lustre/obdclass/class_obd.c +++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c @@ -364,7 +364,15 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg) goto out; } - case OBD_GET_VERSION: + case OBD_GET_VERSION: { + static bool warned; + + /* This was the method to pass to user land the lustre version. + * Today that information is in the sysfs tree so we can in the + * future remove this. + */ + BUILD_BUG_ON(OBD_OCD_VERSION(3, 0, 53, 0) <= LUSTRE_VERSION_CODE); + if (!data->ioc_inlbuf1) { CERROR("No buffer passed in ioctl\n"); err = -EINVAL; @@ -377,13 +385,19 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg) goto out; } + if (!warned) { + warned = true; + CWARN("%s: ioctl(OBD_GET_VERSION) is deprecated, use llapi_get_version_string() and/or relink\n", + current->comm); + } + memcpy(data->ioc_bulk, LUSTRE_VERSION_STRING, strlen(LUSTRE_VERSION_STRING) + 1); if (copy_to_user((void __user *)arg, data, len)) err = -EFAULT; goto out; - + } case OBD_IOC_NAME2DEV: { /* Resolve a device name. This does not change the * currently selected device.