LNet NIDs can be up to LNET_NIDSTR_SIZE (64) bytes (including the NUL
byte), but we are only copying UUID_MAX + 3 (43) bytes of the
userspace buffer. NIDs larger than this would get truncated, no
matching export found, and thus no eviction. Fix it by copying
LNET_NIDSTR_SIZE - 1 bytes.
Test-Parameters: trivial
Test-Parameters: testlist=conf-sanity env=ONLY=91,FORCE_LARGE_NID=true,LOAD_MODULES_REMOTE=true
Signed-off-by: Chris Horn <chris.horn@hpe.com>
Change-Id: I9ca15a89f0d41a6ca355a690a7f9fb25a80d8f82
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/56281
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
}
LPROC_SEQ_FOPS_RO(mdt_site_stats);
-#define BUFLEN (UUID_MAX + 4)
+#define BUFLEN LNET_NIDSTR_SIZE
static ssize_t
lprocfs_mds_evict_client_seq_write(struct file *file, const char __user *buf,
/*
* OBD_ALLOC() will zero kbuf, but we only copy BUFLEN - 1
* bytes into kbuf, to ensure that the string is NUL-terminated.
- * UUID_MAX should include a trailing NUL already.
+ * LNET_NIDSTR_SIZE includes space for a trailing NUL already.
*/
if (copy_from_user(kbuf, buf, min_t(unsigned long, BUFLEN - 1, count)))
GOTO(out, rc = -EFAULT);
EXPORT_SYMBOL(lprocfs_recovery_stale_clients_seq_show);
#ifdef CONFIG_PROC_FS
-#define BUFLEN (UUID_MAX + 5)
+#define BUFLEN LNET_NIDSTR_SIZE
ssize_t
lprocfs_evict_client_seq_write(struct file *file, const char __user *buffer,
/*
* OBD_ALLOC() will zero kbuf, but we only copy BUFLEN - 1
* bytes into kbuf, to ensure that the string is NUL-terminated.
- * UUID_MAX should include a trailing NUL already.
+ * LNET_NIDSTR_SIZE includes space for a trailing NUL already.
*/
if (copy_from_user(kbuf, buffer,
min_t(unsigned long, BUFLEN - 1, count))) {