diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2006-04-07 11:17:32 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2006-04-07 11:17:32 -0400 |
commit | b09e593d799560f1a0782c20ac5900058390a26f (patch) | |
tree | 20f04bd2c8ba9c09ac80a7bb1400d341c4fd7e21 /fs/gfs2/ops_file.c | |
parent | 55eccc6d00cea224bf634d44e9871cfe83200ff2 (diff) |
[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.c | 23 |
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] = { | |||
561 | [gfs2fl_InheritJdata] = IFLAG_INHERITJDATA, | 561 | [gfs2fl_InheritJdata] = IFLAG_INHERITJDATA, |
562 | }; | 562 | }; |
563 | 563 | ||
564 | static int gfs2_get_flags(struct inode *inode, u32 __user *ptr) | 564 | static int gfs2_get_flags(struct file *filp, u32 __user *ptr) |
565 | { | 565 | { |
566 | struct inode *inode = filp->f_dentry->d_inode; | ||
566 | struct gfs2_inode *ip = inode->u.generic_ip; | 567 | struct gfs2_inode *ip = inode->u.generic_ip; |
567 | struct gfs2_holder gh; | 568 | struct gfs2_holder gh; |
568 | int error; | 569 | int error; |
@@ -600,8 +601,9 @@ static int gfs2_get_flags(struct inode *inode, u32 __user *ptr) | |||
600 | * @mask: Indicates which flags are valid | 601 | * @mask: Indicates which flags are valid |
601 | * | 602 | * |
602 | */ | 603 | */ |
603 | static int do_gfs2_set_flags(struct inode *inode, u32 reqflags, u32 mask) | 604 | static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask) |
604 | { | 605 | { |
606 | struct inode *inode = filp->f_dentry->d_inode; | ||
605 | struct gfs2_inode *ip = inode->u.generic_ip; | 607 | struct gfs2_inode *ip = inode->u.generic_ip; |
606 | struct gfs2_sbd *sdp = ip->i_sbd; | 608 | struct gfs2_sbd *sdp = ip->i_sbd; |
607 | struct buffer_head *bh; | 609 | struct buffer_head *bh; |
@@ -659,23 +661,22 @@ out: | |||
659 | return error; | 661 | return error; |
660 | } | 662 | } |
661 | 663 | ||
662 | static int gfs2_set_flags(struct inode *inode, u32 __user *ptr) | 664 | static int gfs2_set_flags(struct file *filp, u32 __user *ptr) |
663 | { | 665 | { |
664 | u32 iflags, gfsflags; | 666 | u32 iflags, gfsflags; |
665 | if (get_user(iflags, ptr)) | 667 | if (get_user(iflags, ptr)) |
666 | return -EFAULT; | 668 | return -EFAULT; |
667 | gfsflags = iflags_cvt(iflags_to_gfs2, iflags); | 669 | gfsflags = iflags_cvt(iflags_to_gfs2, iflags); |
668 | return do_gfs2_set_flags(inode, gfsflags, ~0); | 670 | return do_gfs2_set_flags(filp, gfsflags, ~0); |
669 | } | 671 | } |
670 | 672 | ||
671 | int gfs2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, | 673 | static long gfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
672 | unsigned long arg) | ||
673 | { | 674 | { |
674 | switch(cmd) { | 675 | switch(cmd) { |
675 | case IFLAGS_GET_IOC: | 676 | case IFLAGS_GET_IOC: |
676 | return gfs2_get_flags(inode, (u32 __user *)arg); | 677 | return gfs2_get_flags(filp, (u32 __user *)arg); |
677 | case IFLAGS_SET_IOC: | 678 | case IFLAGS_SET_IOC: |
678 | return gfs2_set_flags(inode, (u32 __user *)arg); | 679 | return gfs2_set_flags(filp, (u32 __user *)arg); |
679 | } | 680 | } |
680 | return -ENOTTY; | 681 | return -ENOTTY; |
681 | } | 682 | } |
@@ -808,7 +809,7 @@ static int gfs2_fsync(struct file *file, struct dentry *dentry, int datasync) | |||
808 | { | 809 | { |
809 | struct gfs2_inode *ip = dentry->d_inode->u.generic_ip; | 810 | struct gfs2_inode *ip = dentry->d_inode->u.generic_ip; |
810 | 811 | ||
811 | gfs2_log_flush_glock(ip->i_gl); | 812 | gfs2_log_flush(ip->i_gl->gl_sbd, ip->i_gl); |
812 | 813 | ||
813 | return 0; | 814 | return 0; |
814 | } | 815 | } |
@@ -974,7 +975,7 @@ struct file_operations gfs2_file_fops = { | |||
974 | .write = generic_file_write, | 975 | .write = generic_file_write, |
975 | .writev = generic_file_writev, | 976 | .writev = generic_file_writev, |
976 | .aio_write = generic_file_aio_write, | 977 | .aio_write = generic_file_aio_write, |
977 | .ioctl = gfs2_ioctl, | 978 | .unlocked_ioctl = gfs2_ioctl, |
978 | .mmap = gfs2_mmap, | 979 | .mmap = gfs2_mmap, |
979 | .open = gfs2_open, | 980 | .open = gfs2_open, |
980 | .release = gfs2_close, | 981 | .release = gfs2_close, |
@@ -988,7 +989,7 @@ struct file_operations gfs2_file_fops = { | |||
988 | 989 | ||
989 | struct file_operations gfs2_dir_fops = { | 990 | struct file_operations gfs2_dir_fops = { |
990 | .readdir = gfs2_readdir, | 991 | .readdir = gfs2_readdir, |
991 | .ioctl = gfs2_ioctl, | 992 | .unlocked_ioctl = gfs2_ioctl, |
992 | .open = gfs2_open, | 993 | .open = gfs2_open, |
993 | .release = gfs2_close, | 994 | .release = gfs2_close, |
994 | .fsync = gfs2_fsync, | 995 | .fsync = gfs2_fsync, |