Whamcloud - gitweb
LU-4416 osd-ldiskfs: set I_LINKABLE for inc_nlink 75/10375/8
authorJeff Mahoney <jeffm@suse.com>
Fri, 6 Jun 2014 19:52:58 +0000 (15:52 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 17 Jun 2014 04:04:20 +0000 (04:04 +0000)
Linux commit f4e0c30c191 (allow the temp files created by open() to be
linked to) put in a check to warn if I_LINKABLE was not set
when trying to pull nlinks up from 0. This patch sets the flag
to properly allow it.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: James Simmons <uja.ornl@gmail.com>
Change-Id: I2a71d0515f3735f8eb3e94d190e68e41a36e0f68
Reviewed-on: http://review.whamcloud.com/10375
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Yang Sheng <yang.sheng@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/osd-ldiskfs/osd_handler.c

index cf6bccc..430bb60 100644 (file)
@@ -2802,6 +2802,13 @@ static int osd_object_ref_add(const struct lu_env *env,
         * This also has to properly handle the case of inodes with nlink == 0
         * in case they are being linked into the PENDING directory
         */
+#ifdef I_LINKABLE
+       /* This is necessary to increment from i_nlink == 0 */
+       spin_lock(&inode->i_lock);
+       inode->i_state |= I_LINKABLE;
+       spin_unlock(&inode->i_lock);
+#endif
+
        spin_lock(&obj->oo_guard);
        ldiskfs_inc_count(oh->ot_handle, inode);
        if (!S_ISDIR(inode->i_mode))