From: Dave Chinner <david@fromorbit.com>
To: Ankit Jain <me@ankitjain.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
mfasheh@suse.com, linux-kernel@vger.kernel.org,
joel.becker@oracle.com, Christoph Hellwig <hch@infradead.org>,
xfs-masters@oss.sgi.com, linux-fsdevel@vger.kernel.org,
xfs@oss.sgi.com, ocfs2-devel@oss.oracle.com
Subject: Re: [PATCH v2] fs: Add new pre-allocation ioctls to vfs for compatibility with legacy xfs ioctls
Date: Fri, 19 Dec 2008 15:37:44 +1100 [thread overview]
Message-ID: <20081219043744.GC17177@disturbed> (raw)
In-Reply-To: <494ABEBC.8060101@ankitjain.org>
On Fri, Dec 19, 2008 at 02:51:00AM +0530, Ankit Jain wrote:
> This patch adds ioctls to vfs for compatibility with legacy XFS
> pre-allocation ioctls (XFS_IOC_*RESVP*). The implementation
> effectively invokes sys_fallocate for the new ioctls.
> Note: These legacy ioctls are also implemented by OCFS2.
>
> Changes in v2:
> - Dropped the incorrect handling of *UNRESVSP* ioctl.
> - Made the ioctl and argument structure kernel only (__KERNEL__)
>
> Signed-off-by: Ankit Jain <me@ankitjain.org>
.....
> @@ -361,6 +393,9 @@ static int file_ioctl(struct file *filp, unsigned int cmd,
> return put_user(inode->i_sb->s_blocksize, p);
> case FIONREAD:
> return put_user(i_size_read(inode) - filp->f_pos, p);
> + case F_IOC_RESVSP:
> + case F_IOC_RESVSP64:
> + return ioctl_preallocate(filp, arg);
> }
>
> return vfs_ioctl(filp, cmd, arg);
Adding this here breaks XFS_IOC_RESVSP in subtle and interesting
ways.
XFS_IOC_RESVSP supports invisible I/O, and that means
XFS_IOC_RESVSP needs to be passed through to vfs_ioctl()
to vector to XFS to handle.
This happenѕ because:
> +struct space_resv {
> + __s16 l_type;
> + __s16 l_whence;
> + __s64 l_start;
> + __s64 l_len; /* len == 0 means until end of file */
> + __s32 l_sysid;
> + __u32 l_pid;
> + __s32 l_pad[4]; /* reserve area */
> +};
> +
> +#define F_IOC_RESVSP _IOW('X', 40, struct space_resv)
> +#define F_IOC_RESVSP64 _IOW('X', 42, struct space_resv)
Is the same as:
#define XFS_IOC_RESVSP _IOW ('X', 40, struct xfs_flock64)
#define XFS_IOC_RESVSP64 _IOW ('X', 42, struct xfs_flock64)
because:
typedef struct xfs_flock64 {
__s16 l_type;
__s16 l_whence;
__s64 l_start;
__s64 l_len; /* len == 0 means until end of file */
__s32 l_sysid;
__u32 l_pid;
__s32 l_pad[4]; /* reserve area */
} xfs_flock64_t;
is the same size as struct space_resv. Hence existing calls to
XFS_IOC_RESVSP will now vector incorrectly down the fallocate path
resulting in invisible operations will now be visible....
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2008-12-19 4:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-18 21:21 [PATCH v2] fs: Add new pre-allocation ioctls to vfs for compatibility with legacy xfs ioctls Ankit Jain
2008-12-19 4:37 ` Dave Chinner [this message]
2008-12-19 8:59 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081219043744.GC17177@disturbed \
--to=david@fromorbit.com \
--cc=hch@infradead.org \
--cc=joel.becker@oracle.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=me@ankitjain.org \
--cc=mfasheh@suse.com \
--cc=ocfs2-devel@oss.oracle.com \
--cc=viro@zeniv.linux.org.uk \
--cc=xfs-masters@oss.sgi.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox