From: Oleg Drokin Date: Sun, 3 Jan 2016 20:53:50 +0000 (-0500) Subject: LU-7623 lov: Get rid of an ugly statfs hack in lov_iocontrol X-Git-Tag: 2.7.66~7 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=9281658095a63c88a12246df5fb6f3b78f97095a LU-7623 lov: Get rid of an ugly statfs hack in lov_iocontrol For some crazy reason ll_obd_statfs decided to decode async flag passed from userspace and then pass it via a userspace pointer argument to lov_iocontrol. This patch moves flags decoding to lov_iocontrol where it belongs. Change-Id: I1b54e778d60b878fc3fc463c256aad360b2cab21 Signed-off-by: Oleg Drokin Reviewed-on: http://review.whamcloud.com/17780 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: John L. Hammond Reviewed-by: James Simmons Reviewed-by: Dmitry Eremin --- diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 050d0e6..cf17367 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -2358,7 +2358,6 @@ int ll_obd_statfs(struct inode *inode, void __user *arg) char *buf = NULL; struct obd_ioctl_data *data = NULL; __u32 type; - __u32 __user flags; /* not user, but obd_iocontrol is abused */ int len = 0, rc; if (!inode || !(sbi = ll_i2sbi(inode))) @@ -2387,8 +2386,7 @@ int ll_obd_statfs(struct inode *inode, void __user *arg) else GOTO(out_statfs, rc = -ENODEV); - flags = (type & LL_STATFS_NODELAY) ? OBD_STATFS_NODELAY : 0; - rc = obd_iocontrol(IOC_OBD_STATFS, exp, len, buf, &flags); + rc = obd_iocontrol(IOC_OBD_STATFS, exp, len, buf, NULL); if (rc) GOTO(out_statfs, rc); out_statfs: diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index d3b3a6c..7c00acf 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -1096,7 +1096,7 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len, __u32 index; __u32 flags; - memcpy(&index, data->ioc_inlbuf2, sizeof(__u32)); + memcpy(&index, data->ioc_inlbuf2, sizeof(index)); if ((index >= count)) RETURN(-ENODEV); @@ -1116,7 +1116,9 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len, sizeof(struct obd_uuid)))) RETURN(-EFAULT); - flags = uarg ? *(__u32 __user *)uarg : 0; + memcpy(&flags, data->ioc_inlbuf1, sizeof(flags)); + flags = flags & LL_STATFS_NODELAY ? OBD_STATFS_NODELAY : 0; + /* got statfs data */ rc = obd_statfs(NULL, lov->lov_tgts[index]->ltd_exp, &stat_buf, cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),