Merge git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-fixes
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 25 May 2010 15:17:51 +0000 (08:17 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 25 May 2010 15:17:51 +0000 (08:17 -0700)
* git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-fixes:
  GFS2: Fix permissions checking for setflags ioctl()
  GFS2: Don't "get" xattrs for ACLs when ACLs are turned off
  GFS2: Rework reclaiming unlinked dinodes

1  2 
fs/gfs2/acl.c
fs/gfs2/rgrp.c

diff --combined fs/gfs2/acl.c
@@@ -236,10 -236,14 +236,14 @@@ static int gfs2_xattr_system_get(struc
                                 void *buffer, size_t size, int xtype)
  {
        struct inode *inode = dentry->d_inode;
+       struct gfs2_sbd *sdp = GFS2_SB(inode);
        struct posix_acl *acl;
        int type;
        int error;
  
+       if (!sdp->sd_args.ar_posix_acl)
+               return -EOPNOTSUPP;
        type = gfs2_acl_type(name);
        if (type < 0)
                return type;
@@@ -335,7 -339,7 +339,7 @@@ out
        return error;
  }
  
 -struct xattr_handler gfs2_xattr_system_handler = {
 +const struct xattr_handler gfs2_xattr_system_handler = {
        .prefix = XATTR_SYSTEM_PREFIX,
        .flags  = GFS2_EATYPE_SYS,
        .get    = gfs2_xattr_system_get,
diff --combined fs/gfs2/rgrp.c
@@@ -854,8 -854,7 +854,8 @@@ static void gfs2_rgrp_send_discards(str
                                if ((start + nr_sects) != blk) {
                                        rv = blkdev_issue_discard(bdev, start,
                                                            nr_sects, GFP_NOFS,
 -                                                          DISCARD_FL_BARRIER);
 +                                                          BLKDEV_IFL_WAIT |
 +                                                          BLKDEV_IFL_BARRIER);
                                        if (rv)
                                                goto fail;
                                        nr_sects = 0;
@@@ -870,7 -869,7 +870,7 @@@ start_new_extent
        }
        if (nr_sects) {
                rv = blkdev_issue_discard(bdev, start, nr_sects, GFP_NOFS,
 -                                       DISCARD_FL_BARRIER);
 +                                       BLKDEV_IFL_WAIT | BLKDEV_IFL_BARRIER);
                if (rv)
                        goto fail;
        }
@@@ -1192,7 -1191,6 +1192,6 @@@ int gfs2_inplace_reserve_i(struct gfs2_
  {
        struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
        struct gfs2_alloc *al = ip->i_alloc;
-       struct inode *inode;
        int error = 0;
        u64 last_unlinked = NO_BLOCK, unlinked;
  
@@@ -1210,22 -1208,27 +1209,27 @@@ try_again
        if (error)
                return error;
  
+       /* Find an rgrp suitable for allocation.  If it encounters any unlinked
+          dinodes along the way, error will equal -EAGAIN and unlinked will
+          contains it block address. We then need to look up that inode and
+          try to free it, and try the allocation again. */
        error = get_local_rgrp(ip, &unlinked, &last_unlinked);
        if (error) {
                if (ip != GFS2_I(sdp->sd_rindex))
                        gfs2_glock_dq_uninit(&al->al_ri_gh);
                if (error != -EAGAIN)
                        return error;
-               error = gfs2_unlinked_inode_lookup(ip->i_inode.i_sb,
-                                                  unlinked, &inode);
-               if (inode)
-                       iput(inode);
+               gfs2_process_unlinked_inode(ip->i_inode.i_sb, unlinked);
+               /* regardless of whether or not gfs2_process_unlinked_inode
+                  was successful, we don't want to repeat it again. */
+               last_unlinked = unlinked;
                gfs2_log_flush(sdp, NULL);
-               if (error == GLR_TRYFAILED)
-                       error = 0;
+               error = 0;
                goto try_again;
        }
+       /* no error, so we have the rgrp set in the inode's allocation. */
        al->al_file = file;
        al->al_line = line;