Merge branch 'skip_delete_inode' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorJoel Becker <joel.becker@oracle.com>
Fri, 30 Apr 2010 20:37:29 +0000 (13:37 -0700)
committerJoel Becker <joel.becker@oracle.com>
Fri, 30 Apr 2010 20:37:29 +0000 (13:37 -0700)
1  2 
fs/ocfs2/buffer_head_io.c
fs/ocfs2/dlm/dlmast.c
fs/ocfs2/inode.c
fs/ocfs2/refcounttree.c

@@@ -25,7 -25,6 +25,6 @@@
  
  #include <linux/fs.h>
  #include <linux/types.h>
- #include <linux/slab.h>
  #include <linux/highmem.h>
  
  #include <cluster/masklog.h>
@@@ -407,7 -406,6 +406,7 @@@ int ocfs2_write_super_or_backup(struct 
                                struct buffer_head *bh)
  {
        int ret = 0;
 +      struct ocfs2_dinode *di = (struct ocfs2_dinode *)bh->b_data;
  
        mlog_entry_void();
  
  
        get_bh(bh); /* for end_buffer_write_sync() */
        bh->b_end_io = end_buffer_write_sync;
 +      ocfs2_compute_meta_ecc(osb->sb, bh->b_data, &di->i_check);
        submit_bh(WRITE, bh);
  
        wait_on_buffer(bh);
diff --combined fs/ocfs2/dlm/dlmast.c
@@@ -28,7 -28,6 +28,6 @@@
  #include <linux/module.h>
  #include <linux/fs.h>
  #include <linux/types.h>
- #include <linux/slab.h>
  #include <linux/highmem.h>
  #include <linux/init.h>
  #include <linux/sysctl.h>
@@@ -185,8 -184,9 +184,8 @@@ static void dlm_update_lvb(struct dlm_c
        BUG_ON(!lksb);
  
        /* only updates if this node masters the lockres */
 +      spin_lock(&res->spinlock);
        if (res->owner == dlm->node_num) {
 -
 -              spin_lock(&res->spinlock);
                /* check the lksb flags for the direction */
                if (lksb->flags & DLM_LKSB_GET_LVB) {
                        mlog(0, "getting lvb from lockres for %s node\n",
                 * here. In the future we might want to clear it at the time
                 * the put is actually done.
                 */
 -              spin_unlock(&res->spinlock);
        }
 +      spin_unlock(&res->spinlock);
  
        /* reset any lvb flags on the lksb */
        lksb->flags &= ~(DLM_LKSB_PUT_LVB|DLM_LKSB_GET_LVB);
diff --combined fs/ocfs2/inode.c
@@@ -25,7 -25,6 +25,6 @@@
  
  #include <linux/fs.h>
  #include <linux/types.h>
- #include <linux/slab.h>
  #include <linux/highmem.h>
  #include <linux/pagemap.h>
  #include <linux/quotaops.h>
@@@ -559,7 -558,6 +558,7 @@@ static int ocfs2_truncate_for_delete(st
                handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
                if (IS_ERR(handle)) {
                        status = PTR_ERR(handle);
 +                      handle = NULL;
                        mlog_errno(status);
                        goto out;
                }
@@@ -641,11 -639,13 +640,13 @@@ static int ocfs2_remove_inode(struct in
                goto bail_unlock;
        }
  
-       status = ocfs2_orphan_del(osb, handle, orphan_dir_inode, inode,
-                                 orphan_dir_bh);
-       if (status < 0) {
-               mlog_errno(status);
-               goto bail_commit;
+       if (!(OCFS2_I(inode)->ip_flags & OCFS2_INODE_SKIP_ORPHAN_DIR)) {
+               status = ocfs2_orphan_del(osb, handle, orphan_dir_inode, inode,
+                                         orphan_dir_bh);
+               if (status < 0) {
+                       mlog_errno(status);
+                       goto bail_commit;
+               }
        }
  
        /* set the inodes dtime */
@@@ -728,34 -728,35 +729,35 @@@ static int ocfs2_wipe_inode(struct inod
        struct inode *orphan_dir_inode = NULL;
        struct buffer_head *orphan_dir_bh = NULL;
        struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
-       struct ocfs2_dinode *di;
+       struct ocfs2_dinode *di = (struct ocfs2_dinode *) di_bh->b_data;
  
-       di = (struct ocfs2_dinode *) di_bh->b_data;
-       orphaned_slot = le16_to_cpu(di->i_orphaned_slot);
+       if (!(OCFS2_I(inode)->ip_flags & OCFS2_INODE_SKIP_ORPHAN_DIR)) {
+               orphaned_slot = le16_to_cpu(di->i_orphaned_slot);
  
-       status = ocfs2_check_orphan_recovery_state(osb, orphaned_slot);
-       if (status)
-               return status;
+               status = ocfs2_check_orphan_recovery_state(osb, orphaned_slot);
+               if (status)
+                       return status;
  
-       orphan_dir_inode = ocfs2_get_system_file_inode(osb,
-                                                      ORPHAN_DIR_SYSTEM_INODE,
-                                                      orphaned_slot);
-       if (!orphan_dir_inode) {
-               status = -EEXIST;
-               mlog_errno(status);
-               goto bail;
-       }
+               orphan_dir_inode = ocfs2_get_system_file_inode(osb,
+                                                              ORPHAN_DIR_SYSTEM_INODE,
+                                                              orphaned_slot);
+               if (!orphan_dir_inode) {
+                       status = -EEXIST;
+                       mlog_errno(status);
+                       goto bail;
+               }
  
-       /* Lock the orphan dir. The lock will be held for the entire
-        * delete_inode operation. We do this now to avoid races with
-        * recovery completion on other nodes. */
-       mutex_lock(&orphan_dir_inode->i_mutex);
-       status = ocfs2_inode_lock(orphan_dir_inode, &orphan_dir_bh, 1);
-       if (status < 0) {
-               mutex_unlock(&orphan_dir_inode->i_mutex);
+               /* Lock the orphan dir. The lock will be held for the entire
+                * delete_inode operation. We do this now to avoid races with
+                * recovery completion on other nodes. */
+               mutex_lock(&orphan_dir_inode->i_mutex);
+               status = ocfs2_inode_lock(orphan_dir_inode, &orphan_dir_bh, 1);
+               if (status < 0) {
+                       mutex_unlock(&orphan_dir_inode->i_mutex);
  
-               mlog_errno(status);
-               goto bail;
+                       mlog_errno(status);
+                       goto bail;
+               }
        }
  
        /* we do this while holding the orphan dir lock because we
                mlog_errno(status);
  
  bail_unlock_dir:
+       if (OCFS2_I(inode)->ip_flags & OCFS2_INODE_SKIP_ORPHAN_DIR)
+               return status;
        ocfs2_inode_unlock(orphan_dir_inode, 1);
        mutex_unlock(&orphan_dir_inode->i_mutex);
        brelse(orphan_dir_bh);
@@@ -891,7 -895,8 +896,8 @@@ static int ocfs2_query_inode_wipe(struc
  
        /* Do some basic inode verification... */
        di = (struct ocfs2_dinode *) di_bh->b_data;
-       if (!(di->i_flags & cpu_to_le32(OCFS2_ORPHANED_FL))) {
+       if (!(di->i_flags & cpu_to_le32(OCFS2_ORPHANED_FL)) &&
+           !(oi->ip_flags & OCFS2_INODE_SKIP_ORPHAN_DIR)) {
                /*
                 * Inodes in the orphan dir must have ORPHANED_FL.  The only
                 * inodes that come back out of the orphan dir are reflink
diff --combined fs/ocfs2/refcounttree.c
@@@ -37,7 -37,6 +37,6 @@@
  
  #include <linux/bio.h>
  #include <linux/blkdev.h>
- #include <linux/gfp.h>
  #include <linux/slab.h>
  #include <linux/writeback.h>
  #include <linux/pagevec.h>
@@@ -4084,9 -4083,6 +4083,9 @@@ static int ocfs2_complete_reflink(struc
        di->i_attr = s_di->i_attr;
  
        if (preserve) {
 +              t_inode->i_uid = s_inode->i_uid;
 +              t_inode->i_gid = s_inode->i_gid;
 +              t_inode->i_mode = s_inode->i_mode;
                di->i_uid = s_di->i_uid;
                di->i_gid = s_di->i_gid;
                di->i_mode = s_di->i_mode;