[Ocfs2-commits] mfasheh commits r1522 - branches/dlm-changes/src
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Wed Sep 29 19:50:20 CDT 2004
Author: mfasheh
Date: 2004-09-29 19:50:19 -0500 (Wed, 29 Sep 2004)
New Revision: 1522
Modified:
branches/dlm-changes/src/alloc.c
Log:
* disable local alloc in the case that we can't reserve anything from it.
* guard that operation inside of io_sem (yes, we'll use something better
later) so that process's coming in won't assume the local alloc is enabled
when it has been shut down.
Modified: branches/dlm-changes/src/alloc.c
===================================================================
--- branches/dlm-changes/src/alloc.c 2004-09-30 00:44:53 UTC (rev 1521)
+++ branches/dlm-changes/src/alloc.c 2004-09-30 00:50:19 UTC (rev 1522)
@@ -3094,8 +3094,15 @@
if ((status < 0) && (status != -ENOSPC)) {
LOG_ERROR_STATUS(status);
goto bail;
- }
- if (status == 0)
+ } else if (status == -ENOSPC) {
+#warning "need to deal with disabling local alloc better"
+ /* reserve_local_bits will return enospc with
+ * the local alloc inode still locked, so we
+ * can change this safely here. */
+ LOG_ERROR_STR("Disabling local alloc");
+ osb->have_local_alloc = 0;
+// ocfs_shutdown_local_alloc(osb);
+ } else
(*ac)->ac_which = OCFS_AC_USE_LOCAL;
}
@@ -3215,6 +3222,17 @@
OCFS_ASSERT(ac);
OCFS_ASSERT(!(passed_handle->flags & OCFS_HANDLE_STARTED));
+ local_alloc_inode =
+ ocfs_get_system_file_inode(osb,
+ LOCAL_ALLOC_SYSTEM_INODE,
+ osb->node_num);
+ if (!local_alloc_inode) {
+ status = -ENOENT;
+ LOG_ERROR_STATUS(status);
+ goto bail;
+ }
+ ocfs_handle_add_inode(passed_handle, local_alloc_inode);
+
if (!osb->have_local_alloc) {
status = -ENOSPC;
goto bail;
@@ -3234,17 +3252,6 @@
goto bail;
}
- local_alloc_inode =
- ocfs_get_system_file_inode(osb,
- LOCAL_ALLOC_SYSTEM_INODE,
- osb->node_num);
- if (!local_alloc_inode) {
- status = -ENOENT;
- LOG_ERROR_STATUS(status);
- goto bail;
- }
- ocfs_handle_add_inode(passed_handle, local_alloc_inode);
-
alloc = (ocfs2_dinode *) osb->local_alloc_bh->b_data;
startoff = ocfs_local_find_clear_bits(osb, alloc, bits_wanted);
if (startoff == -1) {
@@ -4018,12 +4025,32 @@
ocfs_bitmap_free_head *f = NULL;
struct buffer_head *bh = NULL;
ocfs_journal_handle *handle = NULL;
+ struct inode *local_alloc_inode = NULL;
+ ocfs_inode_private *oip;
LOG_ENTRY();
- if (!osb->have_local_alloc)
+ local_alloc_inode =
+ ocfs_get_system_file_inode(osb,
+ LOCAL_ALLOC_SYSTEM_INODE,
+ osb->node_num);
+ if (!local_alloc_inode) {
+ status = -ENOENT;
+ LOG_ERROR_STATUS(status);
goto bail;
+ }
+ oip = OCFS_I(local_alloc_inode);
+ /* Take io_sem here to turn off local alloc before another guy
+ * can come in and start using him. */
+ down_write(&oip->ip_io_sem);
+ if (!osb->have_local_alloc) {
+ up_write(&oip->ip_io_sem);
+ goto bail;
+ }
+ osb->have_local_alloc = 0;
+ up_write(&oip->ip_io_sem);
+
bh = osb->local_alloc_bh;
status = ocfs_sync_local_from_shutdown(osb, &f, bh, 0);
@@ -4070,6 +4097,9 @@
if (f)
ocfs_free_bitmap_free_head(f);
+ if (local_alloc_inode)
+ iput(local_alloc_inode);
+
LOG_EXIT();
return;
} /* ocfs_shutdown_local_alloc */
More information about the Ocfs2-commits
mailing list