[Ocfs2-commits] mfasheh commits r2211 - trunk/fs/ocfs2

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Tue May 3 13:11:26 CDT 2005


Author: mfasheh
Signed-off-by: zab
Date: 2005-05-03 13:11:24 -0500 (Tue, 03 May 2005)
New Revision: 2211

Modified:
   trunk/fs/ocfs2/mmap.c
Log:
* Block signals during nopage

Signed-off-by: zab



Modified: trunk/fs/ocfs2/mmap.c
===================================================================
--- trunk/fs/ocfs2/mmap.c	2005-05-02 23:36:39 UTC (rev 2210)
+++ trunk/fs/ocfs2/mmap.c	2005-05-03 18:11:24 UTC (rev 2211)
@@ -29,6 +29,7 @@
 #include <linux/highmem.h>
 #include <linux/pagemap.h>
 #include <linux/uio.h>
+#include <linux/signal.h>
 #include <linux/rbtree.h>
 
 #define MLOG_MASK_PREFIX ML_FILE_IO
@@ -58,10 +59,10 @@
 				 unsigned long address,
 				 int *type)
 {
-	int status;
-	int locked;
+	int status, tmpstat, locked;
 	struct inode *inode = area->vm_file->f_dentry->d_inode;
 	struct page *page;
+	sigset_t blocked, oldset;
 	DECLARE_IO_MARKER(io_marker);
 
 	mlog_entry("(inode %lu, address %lu)\n", inode->i_ino,
@@ -74,6 +75,19 @@
 		 * from nopage aren't very expressive right now. */
 		page = NOPAGE_SIGBUS;
 
+		/* The best way to deal with signals in this path is
+		 * to block them upfront, rather than allowing the
+		 * locking paths to return -ERESTARTSYS. */
+		sigfillset(&blocked);
+
+		/* We should technically never get a bad status return
+		 * from sigprocmask */
+		status = sigprocmask(SIG_BLOCK, &blocked, &oldset);
+		if (status < 0) {
+			mlog_errno(status);
+			goto bail;
+		}
+
 		/* Since we don't allow shared writable, we need only
 		 * worry about read locking here. */
 		status = ocfs2_meta_lock(inode, NULL, NULL, 0);
@@ -82,7 +96,7 @@
 
 			if (status == -ENOMEM)
 				page = NOPAGE_OOM;
-			goto bail;
+			goto bail_setmask;
 		}
 
 		status = ocfs2_data_lock(inode, 0);
@@ -91,10 +105,13 @@
 
 			if (status == -ENOMEM)
 				page = NOPAGE_OOM;
+			goto bail_unlock;
+		}
 
-			ocfs2_meta_unlock(inode, 0);
-			goto bail;
-		}
+		tmpstat = sigprocmask(SIG_SETMASK, &oldset, NULL);
+		if (tmpstat < 0)
+			mlog_errno(tmpstat);
+
 		/* I'm not sure if we can somehow recurse back into
 		 * nopage or not, but this doesn't cost us anything,
 		 * so lets do it for now. */
@@ -111,6 +128,17 @@
 bail:
 	mlog_exit_ptr(page);
 	return page;
+
+bail_unlock:
+	ocfs2_meta_unlock(inode, 0);
+
+bail_setmask:
+	tmpstat = sigprocmask(SIG_SETMASK, &oldset, NULL);
+	if (tmpstat < 0)
+		mlog_errno(tmpstat);
+
+	mlog_exit_ptr(page);
+	return page;
 }
 
 static struct vm_operations_struct ocfs2_file_vm_ops = {



More information about the Ocfs2-commits mailing list