]> err.no Git - linux-2.6/blobdiff - fs/gfs2/ops_inode.c
[GFS2] Clean up ordered write code
[linux-2.6] / fs / gfs2 / ops_inode.c
index 911c115b5c6c29ecf16aabe087c2be507bb58f71..2cbe5a321e891d0609f06853dbc3761f5bfcd02b 100644 (file)
@@ -69,7 +69,7 @@ static int gfs2_create(struct inode *dir, struct dentry *dentry,
                        mark_inode_dirty(inode);
                        break;
                } else if (PTR_ERR(inode) != -EEXIST ||
-                          (nd->intent.open.flags & O_EXCL)) {
+                          (nd && (nd->intent.open.flags & O_EXCL))) {
                        gfs2_holder_uninit(ghs);
                        return PTR_ERR(inode);
                }
@@ -278,17 +278,25 @@ static int gfs2_unlink(struct inode *dir, struct dentry *dentry)
        gfs2_holder_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 0, ghs + 2);
 
 
-       error = gfs2_glock_nq_m(3, ghs);
+       error = gfs2_glock_nq(ghs); /* parent */
        if (error)
-               goto out;
+               goto out_parent;
+
+       error = gfs2_glock_nq(ghs + 1); /* child */
+       if (error)
+               goto out_child;
+
+       error = gfs2_glock_nq(ghs + 2); /* rgrp */
+       if (error)
+               goto out_rgrp;
 
        error = gfs2_unlink_ok(dip, &dentry->d_name, ip);
        if (error)
-               goto out_gunlock;
+               goto out_rgrp;
 
        error = gfs2_trans_begin(sdp, 2*RES_DINODE + RES_LEAF + RES_RG_BIT, 0);
        if (error)
-               goto out_gunlock;
+               goto out_rgrp;
 
        error = gfs2_dir_del(dip, &dentry->d_name);
         if (error)
@@ -298,12 +306,15 @@ static int gfs2_unlink(struct inode *dir, struct dentry *dentry)
 
 out_end_trans:
        gfs2_trans_end(sdp);
-out_gunlock:
-       gfs2_glock_dq_m(3, ghs);
-out:
-       gfs2_holder_uninit(ghs);
-       gfs2_holder_uninit(ghs + 1);
+       gfs2_glock_dq(ghs + 2);
+out_rgrp:
        gfs2_holder_uninit(ghs + 2);
+       gfs2_glock_dq(ghs + 1);
+out_child:
+       gfs2_holder_uninit(ghs + 1);
+       gfs2_glock_dq(ghs);
+out_parent:
+       gfs2_holder_uninit(ghs);
        gfs2_glock_dq_uninit(&ri_gh);
        return error;
 }