summaryrefslogtreecommitdiffstats
path: root/fs/gfs2/ops_file.c
diff options
context:
space:
mode:
authorSteven Whitehouse2006-04-07 17:17:32 +0200
committerSteven Whitehouse2006-04-07 17:17:32 +0200
commitb09e593d799560f1a0782c20ac5900058390a26f (patch)
tree20f04bd2c8ba9c09ac80a7bb1400d341c4fd7e21 /fs/gfs2/ops_file.c
parent[GFS2] Finish off ioctl support (diff)
downloadkernel-qcow2-linux-b09e593d799560f1a0782c20ac5900058390a26f.tar.gz
kernel-qcow2-linux-b09e593d799560f1a0782c20ac5900058390a26f.tar.xz
kernel-qcow2-linux-b09e593d799560f1a0782c20ac5900058390a26f.zip
[GFS2] Fix a ref count bug and other clean ups
This fixes a ref count bug that sometimes showed up a umount time (causing it to hang) but it otherwise mostly harmless. At the same time there are some clean ups including making the log operations structures const, moving a memory allocation so that its not done in the fast path of checking to see if there is an outstanding transaction related to a particular glock. Removes the sd_log_wrap varaible which was updated, but never actually used anywhere. Updates the gfs2 ioctl() to run without the kernel lock (which it never needed anyway). Removes the "invalidate inodes" loop from GFS2's put_super routine. This is done in kill super anyway so we don't need to do it here. The loop was also bogus in that if there are any inodes "stuck" at this point its a bug and we need to know about it rather than hide it by hanging forever. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/ops_file.c')
-rw-r--r--fs/gfs2/ops_file.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c
index 9bb296717086..3fb1a29f88a6 100644
--- a/fs/gfs2/ops_file.c
+++ b/fs/gfs2/ops_file.c
@@ -561,8 +561,9 @@ static const u32 gfs2_to_iflags[32] = {
[gfs2fl_InheritJdata] = IFLAG_INHERITJDATA,
};
-static int gfs2_get_flags(struct inode *inode, u32 __user *ptr)
+static int gfs2_get_flags(struct file *filp, u32 __user *ptr)
{
+ struct inode *inode = filp->f_dentry->d_inode;
struct gfs2_inode *ip = inode->u.generic_ip;
struct gfs2_holder gh;
int error;
@@ -600,8 +601,9 @@ static int gfs2_get_flags(struct inode *inode, u32 __user *ptr)
* @mask: Indicates which flags are valid
*
*/
-static int do_gfs2_set_flags(struct inode *inode, u32 reqflags, u32 mask)
+static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask)
{
+ struct inode *inode = filp->f_dentry->d_inode;
struct gfs2_inode *ip = inode->u.generic_ip;
struct gfs2_sbd *sdp = ip->i_sbd;
struct buffer_head *bh;
@@ -659,23 +661,22 @@ out:
return error;
}
-static int gfs2_set_flags(struct inode *inode, u32 __user *ptr)
+static int gfs2_set_flags(struct file *filp, u32 __user *ptr)
{
u32 iflags, gfsflags;
if (get_user(iflags, ptr))
return -EFAULT;
gfsflags = iflags_cvt(iflags_to_gfs2, iflags);
- return do_gfs2_set_flags(inode, gfsflags, ~0);
+ return do_gfs2_set_flags(filp, gfsflags, ~0);
}
-int gfs2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
- unsigned long arg)
+static long gfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
switch(cmd) {
case IFLAGS_GET_IOC:
- return gfs2_get_flags(inode, (u32 __user *)arg);
+ return gfs2_get_flags(filp, (u32 __user *)arg);
case IFLAGS_SET_IOC:
- return gfs2_set_flags(inode, (u32 __user *)arg);
+ return gfs2_set_flags(filp, (u32 __user *)arg);
}
return -ENOTTY;
}
@@ -808,7 +809,7 @@ static int gfs2_fsync(struct file *file, struct dentry *dentry, int datasync)
{
struct gfs2_inode *ip = dentry->d_inode->u.generic_ip;
- gfs2_log_flush_glock(ip->i_gl);
+ gfs2_log_flush(ip->i_gl->gl_sbd, ip->i_gl);
return 0;
}
@@ -974,7 +975,7 @@ struct file_operations gfs2_file_fops = {
.write = generic_file_write,
.writev = generic_file_writev,
.aio_write = generic_file_aio_write,
- .ioctl = gfs2_ioctl,
+ .unlocked_ioctl = gfs2_ioctl,
.mmap = gfs2_mmap,
.open = gfs2_open,
.release = gfs2_close,
@@ -988,7 +989,7 @@ struct file_operations gfs2_file_fops = {
struct file_operations gfs2_dir_fops = {
.readdir = gfs2_readdir,
- .ioctl = gfs2_ioctl,
+ .unlocked_ioctl = gfs2_ioctl,
.open = gfs2_open,
.release = gfs2_close,
.fsync = gfs2_fsync,