[Ocfs2-commits] mfasheh commits r1417 - trunk/src

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Thu Sep 2 13:47:14 CDT 2004


Author: mfasheh
Date: 2004-09-02 13:47:12 -0500 (Thu, 02 Sep 2004)
New Revision: 1417

Modified:
   trunk/src/namei.c
Log:
* fail create of files in orphaned directories.



Modified: trunk/src/namei.c
===================================================================
--- trunk/src/namei.c	2004-09-02 18:46:39 UTC (rev 1416)
+++ trunk/src/namei.c	2004-09-02 18:47:12 UTC (rev 1417)
@@ -187,6 +187,7 @@
 	ocfs_journal_handle *handle = NULL;
 	ocfs_super *osb;
 	ocfs2_dinode *fe = NULL;
+	ocfs2_dinode *dirfe;
 	struct buffer_head *new_fe_bh = NULL;
 	struct inode *inode = NULL;
 
@@ -249,6 +250,13 @@
 	/* Ok, we got the lock -- we'd better add it to our transaction */
 	ocfs_handle_add_lock(handle, OCFS_LKM_EXMODE, FLAG_DIR, dir);
 
+	dirfe = (ocfs2_dinode *) parent_fe_bh->b_data;
+	if (!dirfe->i_links_count) {
+		/* can't make a file in a deleted directory. */
+		status = -ENOENT;
+		goto leave;
+	}
+
 	/* do the real work now. */
 	status = ocfs_mknod_locked(osb, dir, dentry, mode, dev,
 				   &new_fe_bh, parent_fe_bh, handle, inode);
@@ -1455,6 +1463,7 @@
 	struct buffer_head *new_fe_bh = NULL;
 	struct buffer_head *parent_fe_bh = NULL;
 	ocfs2_dinode *fe = NULL;
+	ocfs2_dinode *dirfe;
 	ocfs_journal_handle *handle = NULL;
 	int credits;
 
@@ -1507,6 +1516,13 @@
 
 	ocfs_handle_add_lock(handle, OCFS_LKM_EXMODE, FLAG_DIR, dir);
 
+	dirfe = (ocfs2_dinode *) parent_fe_bh->b_data;
+	if (!dirfe->i_links_count) {
+		/* can't make a file in a deleted directory. */
+		status = -ENOENT;
+		goto abort_trans;
+	}
+
 	status = ocfs_mknod_locked(osb, dir, dentry, 
  				   S_IFLNK | S_IRWXUGO, 0,
  				   &new_fe_bh, parent_fe_bh, handle,



More information about the Ocfs2-commits mailing list