[Ocfs2-commits] mfasheh commits r2310 - trunk/fs/ocfs2
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Mon May 23 19:53:36 CDT 2005
Author: mfasheh
Signed-off-by: jlbec
Date: 2005-05-23 19:53:34 -0500 (Mon, 23 May 2005)
New Revision: 2310
Modified:
trunk/fs/ocfs2/inode.c
trunk/fs/ocfs2/inode.h
trunk/fs/ocfs2/super.c
trunk/fs/ocfs2/vote.c
Log:
* block signals in ocfs2_delete_inode. this fixes a bug where we were
catching them in the locking layers and leaving inodes in the orphan
dir.
Signed-off-by: jlbec
Modified: trunk/fs/ocfs2/inode.c
===================================================================
--- trunk/fs/ocfs2/inode.c 2005-05-24 00:13:19 UTC (rev 2309)
+++ trunk/fs/ocfs2/inode.c 2005-05-24 00:53:34 UTC (rev 2310)
@@ -442,11 +442,7 @@
return status;
}
-/*
- * ocfs_delete_inode()
- *
- */
-void ocfs_delete_inode(struct inode *inode)
+void ocfs2_delete_inode(struct inode *inode)
{
int status = 0;
int orphaned_slot;
@@ -458,6 +454,7 @@
struct buffer_head *inode_alloc_bh = NULL;
struct buffer_head *fe_bh = NULL;
ocfs2_dinode *fe;
+ sigset_t blocked, oldset;
mlog_entry("(inode->i_ino = %lu)\n", inode->i_ino);
@@ -491,6 +488,17 @@
goto bail;
}
+ /* We want to blocks signals in delete_inode as the lock and
+ * messaging paths may return us -ERESTARTSYS. This however
+ * could result in inodes being orphaned forever. */
+ sigfillset(&blocked);
+
+ status = sigprocmask(SIG_BLOCK, &blocked, &oldset);
+ if (status < 0) {
+ mlog_errno(status);
+ goto bail;
+ }
+
/* ocfs2_meta_lock and friends might igrab / iput this guy, so we
* take an extra ref. to avoid recursive calls to
* delete_inode. */
@@ -499,7 +507,7 @@
atomic_dec(&inode->i_count);
if (status < 0) {
mlog_errno(status);
- goto bail;
+ goto bail_unblock;
}
/* While we were waiting for the lock, another node might have
@@ -510,7 +518,7 @@
spin_unlock(&OCFS2_I(inode)->ip_lock);
mlog(0, "Skipping delete of %lu because another node "
"has done this for us.\n", inode->i_ino);
- goto bail;
+ goto bail_unblock;
}
spin_unlock(&OCFS2_I(inode)->ip_lock);
@@ -522,7 +530,7 @@
* about deleting it. */
if (status != -EBUSY)
mlog_errno(status);
- goto bail;
+ goto bail_unblock;
}
spin_lock(&OCFS2_I(inode)->ip_lock);
@@ -541,7 +549,7 @@
spin_lock(&OCFS2_I(inode)->ip_lock);
SET_INODE_DELETED(inode);
spin_unlock(&OCFS2_I(inode)->ip_lock);
- goto bail;
+ goto bail_unblock;
}
mlog(0, "Inode %"MLFu64" is ok to wipe from orphan dir slot %d\n",
@@ -552,20 +560,20 @@
/* for lack of a better error? */
status = -EEXIST;
mlog_errno(status);
- goto bail;
+ goto bail_unblock;
}
/* has someone already deleted us?! baaad... */
if (fe->i_dtime) {
status = -EEXIST;
mlog_errno(status);
- goto bail;
+ goto bail_unblock;
}
if (fe->i_links_count) {
status = -EBUSY;
mlog_errno(status);
- goto bail;
+ goto bail_unblock;
}
/* Oop, lets be carefull of lock / trans ordering here... */
@@ -573,7 +581,7 @@
if (handle == NULL) {
status = -ENOMEM;
mlog_errno(status);
- goto bail;
+ goto bail_unblock;
}
orphan_dir_inode = ocfs_get_system_file_inode(osb,
@@ -582,13 +590,13 @@
if (!orphan_dir_inode) {
status = -EEXIST;
mlog_errno(status);
- goto bail;
+ goto bail_unblock;
}
ocfs_handle_add_inode(handle, orphan_dir_inode);
status = ocfs2_meta_lock(orphan_dir_inode, handle, &orphan_dir_bh, 1);
if (status < 0) {
mlog_errno(status);
- goto bail;
+ goto bail_unblock;
}
/* we do this while holding the orphan dir lock because we
@@ -598,7 +606,7 @@
status = ocfs_truncate_for_delete(osb, inode, fe_bh);
if (status < 0) {
mlog_errno(status);
- goto bail;
+ goto bail_unblock;
}
inode_alloc_inode =
@@ -607,27 +615,27 @@
if (!inode_alloc_inode) {
status = -EEXIST;
mlog_errno(status);
- goto bail;
+ goto bail_unblock;
}
ocfs_handle_add_inode(handle, inode_alloc_inode);
status = ocfs2_meta_lock(inode_alloc_inode, handle, &inode_alloc_bh, 1);
if (status < 0) {
mlog_errno(status);
- goto bail;
+ goto bail_unblock;
}
handle = ocfs_start_trans(osb, handle, OCFS_DELETE_INODE_CREDITS);
if (handle == NULL) {
status = -ENOMEM;
mlog_errno(status);
- goto bail;
+ goto bail_unblock;
}
status = ocfs_orphan_del(osb, handle, orphan_dir_inode, inode,
orphan_dir_bh);
if (status < 0) {
mlog_errno(status);
- goto bail;
+ goto bail_unblock;
}
/* set the inodes dtime */
@@ -635,7 +643,7 @@
OCFS_JOURNAL_ACCESS_WRITE);
if (status < 0) {
mlog_errno(status);
- goto bail;
+ goto bail_unblock;
}
fe->i_dtime = CURRENT_TIME.tv_sec;
@@ -644,17 +652,22 @@
status = ocfs_journal_dirty(handle, fe_bh);
if (status < 0) {
mlog_errno(status);
- goto bail;
+ goto bail_unblock;
}
status = ocfs2_free_dinode(handle, inode_alloc_inode,
inode_alloc_bh, fe);
if (status < 0) {
mlog_errno(status);
- goto bail;
+ goto bail_unblock;
}
SET_INODE_DELETED(inode);
+bail_unblock:
+ status = sigprocmask(SIG_SETMASK, &oldset, NULL);
+ if (status < 0)
+ mlog_errno(status);
+
bail:
if (handle)
ocfs_commit_trans(handle);
@@ -672,7 +685,7 @@
/* we must clear inode. */
clear_inode(inode);
mlog_exit_void();
-} /* ocfs_delete_inode */
+}
/*
* ocfs2_clear_inode()
Modified: trunk/fs/ocfs2/inode.h
===================================================================
--- trunk/fs/ocfs2/inode.h 2005-05-24 00:13:19 UTC (rev 2309)
+++ trunk/fs/ocfs2/inode.h 2005-05-24 00:53:34 UTC (rev 2310)
@@ -104,7 +104,7 @@
struct buffer_head *ocfs_bread(struct inode * inode, int block,
int *err, int reada);
void ocfs2_clear_inode(struct inode *inode);
-void ocfs_delete_inode(struct inode *inode);
+void ocfs2_delete_inode(struct inode *inode);
struct inode *ocfs_iget(ocfs_super *osb, u64 feoff);
struct inode *ocfs_ilookup(ocfs_super *osb, u64 feoff);
int ocfs_inode_init_private(struct inode *inode);
Modified: trunk/fs/ocfs2/super.c
===================================================================
--- trunk/fs/ocfs2/super.c 2005-05-24 00:13:19 UTC (rev 2309)
+++ trunk/fs/ocfs2/super.c 2005-05-24 00:53:34 UTC (rev 2310)
@@ -111,7 +111,7 @@
.alloc_inode = ocfs2_alloc_inode,
.destroy_inode = ocfs2_destroy_inode,
.clear_inode = ocfs2_clear_inode,
- .delete_inode = ocfs_delete_inode,
+ .delete_inode = ocfs2_delete_inode,
.sync_fs = ocfs2_sync_fs,
.write_super = ocfs_write_super,
.put_super = ocfs_put_super,
Modified: trunk/fs/ocfs2/vote.c
===================================================================
--- trunk/fs/ocfs2/vote.c 2005-05-24 00:13:19 UTC (rev 2309)
+++ trunk/fs/ocfs2/vote.c 2005-05-24 00:53:34 UTC (rev 2310)
@@ -719,7 +719,7 @@
/* Ok, the responding node knows which slot this inode is
* orphaned in. We verify that the information is correct and
- * then record this in the inode. ocfs_delete_inode will use
+ * then record this in the inode. ocfs2_delete_inode will use
* this information to determine which lock to take. */
spin_lock(&OCFS2_I(inode)->ip_lock);
mlog_bug_on_msg(OCFS2_I(inode)->ip_orphaned_slot != orphaned_slot &&
More information about the Ocfs2-commits
mailing list