[lustre-devel] [PATCH 15/21] lustre: obdclass: char obd_ioctl_getdata type.

NeilBrown neilb at suse.com
Sun Feb 10 16:52:39 PST 2019


On Fri, Feb 08 2019, Andreas Dilger wrote:

> On Feb 6, 2019, at 17:03, NeilBrown <neilb at suse.com> wrote:
>> 
>> Instead of having obd_ioctl_getdata() return the allocated
>> data as a "char *", return it as it really is,
>> struct obd_ioctl_data *
>> 
>> This avoids the need for extra variables and casts.
>> 
>> Signed-off-by: NeilBrown <neilb at suse.com>
>
> Most of the patch looks like a no-op, except at one part below:
>
>> @@ -1651,18 +1647,16 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
>> 		return rc;
>> 	}
>> 	case LL_IOC_MIGRATE: {
>> -		char *buf = NULL;
>> 		const char *filename;
>> 		int namelen = 0;
>> 		int len;
>> 		int rc;
>> 		int mdtidx;
>> 
>> -		rc = obd_ioctl_getdata(&buf, &len, (void __user *)arg);
>> +		rc = obd_ioctl_getdata(&data, &len, (void __user *)arg);
>> 		if (rc < 0)
>> 			return rc;
>> 
>> -		data = (struct obd_ioctl_data *)buf;
>> 		if (!data->ioc_inlbuf1 || !data->ioc_inlbuf2 ||
>> 		    !data->ioc_inllen1 || !data->ioc_inllen2) {
>> 			rc = -EINVAL;
>> @@ -1684,7 +1678,6 @@ static long ll_dir_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
>> 
>> 		rc = ll_migrate(inode, file, mdtidx, filename, namelen - 1);
>> migrate_free:
>> -		kvfree(buf);
>
> This removes the call to kvfree(buf) but it isn't clear why, since the rest of
> the patch is mostly variable renaming?

Thanks for catching that!  It should be:

 migrate_free:
-               kvfree(buf);
+               kvfree(data);
 
of course.  Fixed now.

NeilBrown
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20190211/9eda8de4/attachment.sig>


More information about the lustre-devel mailing list