Whamcloud - gitweb
LU-7623 lov: Get rid of an ugly statfs hack in lov_iocontrol 80/17780/3
authorOleg Drokin <oleg.drokin@intel.com>
Sun, 3 Jan 2016 20:53:50 +0000 (15:53 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 28 Jan 2016 18:15:31 +0000 (18:15 +0000)
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 <oleg.drokin@intel.com>
Reviewed-on: http://review.whamcloud.com/17780
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
lustre/llite/llite_lib.c
lustre/lov/lov_obd.c

index 050d0e6..cf17367 100644 (file)
@@ -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;
         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)))
         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);
 
         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:
         if (rc)
                 GOTO(out_statfs, rc);
 out_statfs:
index d3b3a6c..7c00acf 100644 (file)
@@ -1096,7 +1096,7 @@ static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                 __u32 index;
                __u32 flags;
 
                 __u32 index;
                __u32 flags;
 
-                memcpy(&index, data->ioc_inlbuf2, sizeof(__u32));
+                memcpy(&index, data->ioc_inlbuf2, sizeof(index));
                 if ((index >= count))
                         RETURN(-ENODEV);
 
                 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);
 
                                       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),
                 /* got statfs data */
                 rc = obd_statfs(NULL, lov->lov_tgts[index]->ltd_exp, &stat_buf,
                                 cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),