* [PATCH 1/2] vfs: call file_ioctl call for directories.
@ 2009-04-15 14:39 Aneesh Kumar K.V
2009-04-15 14:39 ` [PATCH 2/2] ext4: hook fiemap operation " Aneesh Kumar K.V
2009-05-02 23:06 ` [PATCH 1/2] vfs: call file_ioctl call " Theodore Tso
0 siblings, 2 replies; 7+ messages in thread
From: Aneesh Kumar K.V @ 2009-04-15 14:39 UTC (permalink / raw)
To: cmm, tytso, sandeen; +Cc: linux-ext4, Aneesh Kumar K.V
Most of the ioctl callback in file_ioctl should be done even
for directories. For ext4 fiemap should work even for directories.
Similarly FIGETBSZ should work for directories. For bmap filefrag command
doesn't do the ioctl if the type is not a regular file.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
fs/ioctl.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/fs/ioctl.c b/fs/ioctl.c
index ac2d47e..328b533 100644
--- a/fs/ioctl.c
+++ b/fs/ioctl.c
@@ -523,7 +523,8 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
break;
default:
- if (S_ISREG(filp->f_path.dentry->d_inode->i_mode))
+ if (S_ISDIR(filp->f_path.dentry->d_inode->i_mode) ||
+ S_ISREG(filp->f_path.dentry->d_inode->i_mode))
error = file_ioctl(filp, cmd, arg);
else
error = vfs_ioctl(filp, cmd, arg);
--
tg: (0882e8d..) dir_fiemap (depends on: master)
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] ext4: hook fiemap operation for directories
2009-04-15 14:39 [PATCH 1/2] vfs: call file_ioctl call for directories Aneesh Kumar K.V
@ 2009-04-15 14:39 ` Aneesh Kumar K.V
2009-05-02 23:06 ` Theodore Tso
2009-05-02 23:06 ` [PATCH 1/2] vfs: call file_ioctl call " Theodore Tso
1 sibling, 1 reply; 7+ messages in thread
From: Aneesh Kumar K.V @ 2009-04-15 14:39 UTC (permalink / raw)
To: cmm, tytso, sandeen; +Cc: linux-ext4, Aneesh Kumar K.V
Add fiemap callback for directories
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
fs/ext4/namei.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 22098e1..5e5e311 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -2533,6 +2533,7 @@ const struct inode_operations ext4_dir_inode_operations = {
.removexattr = generic_removexattr,
#endif
.permission = ext4_permission,
+ .fiemap = ext4_fiemap,
};
const struct inode_operations ext4_special_inode_operations = {
--
tg: (e60eece..) ext4_dir_fiemap (depends on: dir_fiemap)
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] vfs: call file_ioctl call for directories.
2009-04-15 14:39 [PATCH 1/2] vfs: call file_ioctl call for directories Aneesh Kumar K.V
2009-04-15 14:39 ` [PATCH 2/2] ext4: hook fiemap operation " Aneesh Kumar K.V
@ 2009-05-02 23:06 ` Theodore Tso
2009-05-03 20:30 ` Theodore Tso
1 sibling, 1 reply; 7+ messages in thread
From: Theodore Tso @ 2009-05-02 23:06 UTC (permalink / raw)
To: Aneesh Kumar K.V; +Cc: cmm, sandeen, linux-ext4
On Wed, Apr 15, 2009 at 08:09:02PM +0530, Aneesh Kumar K.V wrote:
> Most of the ioctl callback in file_ioctl should be done even
> for directories. For ext4 fiemap should work even for directories.
> Similarly FIGETBSZ should work for directories. For bmap filefrag command
> doesn't do the ioctl if the type is not a regular file.
>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Thanks, I've pulled this into the ext4 patch queue.
- Ted
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] ext4: hook fiemap operation for directories
2009-04-15 14:39 ` [PATCH 2/2] ext4: hook fiemap operation " Aneesh Kumar K.V
@ 2009-05-02 23:06 ` Theodore Tso
0 siblings, 0 replies; 7+ messages in thread
From: Theodore Tso @ 2009-05-02 23:06 UTC (permalink / raw)
To: Aneesh Kumar K.V; +Cc: cmm, sandeen, linux-ext4
On Wed, Apr 15, 2009 at 08:09:03PM +0530, Aneesh Kumar K.V wrote:
> Add fiemap callback for directories
>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Thanks, I've pulled this into the ext4 patch queue.
- Ted
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] vfs: call file_ioctl call for directories.
2009-05-02 23:06 ` [PATCH 1/2] vfs: call file_ioctl call " Theodore Tso
@ 2009-05-03 20:30 ` Theodore Tso
2009-05-04 9:02 ` [PATCH -V2] vfs: Enable FS_IOC_FIEMAP and FIGETBSZ for all filetypes Aneesh Kumar K.V
0 siblings, 1 reply; 7+ messages in thread
From: Theodore Tso @ 2009-05-03 20:30 UTC (permalink / raw)
To: Aneesh Kumar K.V; +Cc: cmm, sandeen, linux-ext4
On Sat, May 02, 2009 at 07:06:38PM -0400, Theodore Tso wrote:
> On Wed, Apr 15, 2009 at 08:09:02PM +0530, Aneesh Kumar K.V wrote:
> > Most of the ioctl callback in file_ioctl should be done even
> > for directories. For ext4 fiemap should work even for directories.
> > Similarly FIGETBSZ should work for directories. For bmap filefrag command
> > doesn't do the ioctl if the type is not a regular file.
> >
> > Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
>
> Thanks, I've pulled this into the ext4 patch queue.
>
I've had to remove this from the ext4 patch queue --- it causes udevd
to spin in an endless loop:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2865 root 16 -4 2220 572 312 R 99 0.0 11:42.06 udevd
<tytso.root@mini-me> {/home/tytso}, level 2
498# strace -p 2865 | head -10
Process 2865 attached - interrupt to quit
ppoll([{fd=4, events=POLLIN}, {fd=5, events=POLLIN}, {fd=3, events=POLLIN}], 3, NULL, [], 8) = 1 ([{fd=3, revents=POLLIN}])
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
ioctl(3, FIONREAD, [0]) = 0
rt_sigprocmask(SIG_SETMASK, ~[RTMIN RT_1], [], 8) = 0
ppoll([{fd=4, events=POLLIN}, {fd=5, events=POLLIN}, {fd=3, events=POLLIN}], 3, NULL, [], 8) = 1 ([{fd=3, revents=POLLIN}])
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
ioctl(3, FIONREAD, [0]) = 0
...
<tytso.root@mini-me> {/home/tytso}, level 2
499# ls -l /proc/2865/fd
total 0
0 lrwx------ 1 root root 64 2009-05-03 16:14 0 -> /dev/null
0 lrwx------ 1 root root 64 2009-05-03 16:14 1 -> /dev/null
0 lrwx------ 1 root root 64 2009-05-03 16:14 2 -> /dev/null
0 lr-x------ 1 root root 64 2009-05-03 16:14 3 -> inotify
0 lrwx------ 1 root root 64 2009-05-03 16:14 4 -> socket:[8026]
0 lrwx------ 1 root root 64 2009-05-03 16:14 5 -> socket:[8027]
I haven't had time to investigate more deeply than this. My guess on
quick examination is that the inotify file descriptor must be a
directory, and using the FIONREAD ioctl from file_ioctl is disastrous
for udevd.
Aneesh, do you have time to look at this, since this was originally
your patch? Clearly we can't push this if it causes this regression
with udevd. Maybe we'd be better off simply adding an FIEMAP and
FIGETBSZ case statements to vfs_ioctl, explicitly just for
directories?
- Ted
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH -V2] vfs: Enable FS_IOC_FIEMAP and FIGETBSZ for all filetypes
2009-05-03 20:30 ` Theodore Tso
@ 2009-05-04 9:02 ` Aneesh Kumar K.V
2009-05-13 22:42 ` Theodore Tso
0 siblings, 1 reply; 7+ messages in thread
From: Aneesh Kumar K.V @ 2009-05-04 9:02 UTC (permalink / raw)
To: cmm, tytso, sandeen; +Cc: linux-ext4, Aneesh Kumar K.V
fiemap and get_blk_size ioctl should be enabled even for directories.
So move it outisde file_ioctl. Enabling file_ioctl for both
directories and files cause udev to hang when using FIONREAD. I guess
some of the user space may depend on these ioctls cmd failing on
directories.
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
fs/ioctl.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/fs/ioctl.c b/fs/ioctl.c
index ac2d47e..5362398 100644
--- a/fs/ioctl.c
+++ b/fs/ioctl.c
@@ -379,10 +379,6 @@ static int file_ioctl(struct file *filp, unsigned int cmd,
switch (cmd) {
case FIBMAP:
return ioctl_fibmap(filp, p);
- case FS_IOC_FIEMAP:
- return ioctl_fiemap(filp, arg);
- case FIGETBSZ:
- return put_user(inode->i_sb->s_blocksize, p);
case FIONREAD:
return put_user(i_size_read(inode) - filp->f_pos, p);
}
@@ -522,6 +518,16 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
error = ioctl_fsthaw(filp);
break;
+ case FS_IOC_FIEMAP:
+ return ioctl_fiemap(filp, arg);
+
+ case FIGETBSZ:
+ {
+ struct inode *inode = filp->f_path.dentry->d_inode;
+ int __user *p = (int __user *)arg;
+ return put_user(inode->i_sb->s_blocksize, p);
+ }
+
default:
if (S_ISREG(filp->f_path.dentry->d_inode->i_mode))
error = file_ioctl(filp, cmd, arg);
--
1.6.3.rc4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH -V2] vfs: Enable FS_IOC_FIEMAP and FIGETBSZ for all filetypes
2009-05-04 9:02 ` [PATCH -V2] vfs: Enable FS_IOC_FIEMAP and FIGETBSZ for all filetypes Aneesh Kumar K.V
@ 2009-05-13 22:42 ` Theodore Tso
0 siblings, 0 replies; 7+ messages in thread
From: Theodore Tso @ 2009-05-13 22:42 UTC (permalink / raw)
To: Aneesh Kumar K.V; +Cc: cmm, sandeen, linux-ext4
On Mon, May 04, 2009 at 02:32:22PM +0530, Aneesh Kumar K.V wrote:
> fiemap and get_blk_size ioctl should be enabled even for directories.
> So move it outisde file_ioctl. Enabling file_ioctl for both
> directories and files cause udev to hang when using FIONREAD. I guess
> some of the user space may depend on these ioctls cmd failing on
> directories.
I've added this patch to the ext4 patch queue.
- Ted
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-05-13 22:42 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-15 14:39 [PATCH 1/2] vfs: call file_ioctl call for directories Aneesh Kumar K.V
2009-04-15 14:39 ` [PATCH 2/2] ext4: hook fiemap operation " Aneesh Kumar K.V
2009-05-02 23:06 ` Theodore Tso
2009-05-02 23:06 ` [PATCH 1/2] vfs: call file_ioctl call " Theodore Tso
2009-05-03 20:30 ` Theodore Tso
2009-05-04 9:02 ` [PATCH -V2] vfs: Enable FS_IOC_FIEMAP and FIGETBSZ for all filetypes Aneesh Kumar K.V
2009-05-13 22:42 ` Theodore Tso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).