Skip to contentSkip to conversation

bugfix for unlinking on 2.6 kernel

PATCH In review Rusty Lynch 2 participants 2 messages Mar 14, 2004 – Mar 16, 2004 OCFS2

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bugfix for unlinking on 2.6 kernel

On a 2.6 kernel, sys_unlink will wrap the call to the filesystem unlink function with atomic_inc/atomic_dec of the inode->i_count.

The following minimal patch fixes ocfs_unlink to take this into consideration. (Without this patch attempting to delete any file on a ocfs2 volume from a 2.6 bases system would result in an -EBUSY error.)

    --rusty
namei.c +8 -0
Index: src/namei.c
===================================================================
@@ -575,7 +575,15 @@
 	__u64 parentOff, fileOff;
 	bool do_release = false;
 	struct inode *parentInode = dentry->d_parent->d_inode;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+	/* 
+	 * On a 2.6 kernel sys_unlink will increment the inode 
+	 * count before calling the filesystem unlink function
+	 */
+	int max_cnt = 3; /* one for this process, inode hash, and sys_unlink */
+#else
 	int max_cnt = 2; /* one for this process and one for inode hash */
+#endif
 
 	LOG_ENTRY_ARGS ("(0x%08x, 0x%08x, '%*s')\n", dir, dentry,
                         dentry->d_name.len, dentry->d_name.name);
#1 lore raw
Quoted 7 lines · Rusty Lynch

On a 2.6 kernel, sys_unlink will wrap the call to the filesystem unlink function with atomic_inc/atomic_dec of the inode->i_count.

The following minimal patch fixes ocfs_unlink to take this into consideration. (Without this patch attempting to delete any file on a ocfs2 volume from a 2.6 bases system would result in an -EBUSY error.)

Looks good.

	--Mark

--
Mark Fasheh
Software Developer, Oracle Corp
[email protected]