aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Deininger <dma05@web.de>2008-10-17 12:44:46 -0500
committerEric Van Hensbergen <ericvh@gmail.com>2008-10-17 12:44:46 -0500
commit57c7b4e68edf3b4fe7f977db9ad437e0f7f7c382 (patch)
tree4ea7680bbe24867f313f29cc2429da26a62c67af
parente7f4b8f1a5893ff8296b5b581e16a0b96f60a3b5 (diff)
9p: fix device file handling
In v9fs_get_inode(), for block, as well as char devices (in theory), the function init_special_inode() is called to set up callback functions for file ops. this function uses the file mode's value to determine whether to use block or char dev functions. In v9fs_inode_from_fid(), the function p9mode2unixmode() is used, but for all devices it initially returns S_IFBLK, then uses v9fs_get_inode() to initialise a new inode, then finally uses v9fs_stat2inode(), which would determine whether the inode is a block or character device. However, at that point init_special_inode() had already decided to use the block device functions, so even if the inode's mode is turned to a character device, the block functions are still used to operate on them. The attached patch simply calls init_special_inode() again for devices after parsing device node data in v9fs_stat2inode() so that the proper functions are used. Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
-rw-r--r--fs/9p/vfs_inode.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index e96d84aafbe..8314d3f43b7 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -864,6 +864,7 @@ v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode,
stat->extension);
};
inode->i_rdev = MKDEV(major, minor);
+ init_special_inode(inode, inode->i_mode, inode->i_rdev);
} else
inode->i_rdev = 0;