[Ocfs2-commits] manish commits r2102 - trunk/fs/ocfs2
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Sat Apr 2 00:06:42 CST 2005
Author: manish
Signed-off-by: mfasheh
Date: 2005-04-02 00:06:41 -0600 (Sat, 02 Apr 2005)
New Revision: 2102
Modified:
trunk/fs/ocfs2/mmap.c
trunk/fs/ocfs2/namei.c
trunk/fs/ocfs2/super.c
Log:
Make ocfs2 exportable via nfs. We can probably do better by fleshing out
export_operations, but we have the basics right now.
Signed-off-by: mfasheh
Modified: trunk/fs/ocfs2/mmap.c
===================================================================
--- trunk/fs/ocfs2/mmap.c 2005-04-01 23:32:39 UTC (rev 2101)
+++ trunk/fs/ocfs2/mmap.c 2005-04-02 06:06:41 UTC (rev 2102)
@@ -252,12 +252,10 @@
ocfs2_buffer_lock_ctxt *ctxt,
ocfs2_backing_inode **target_binode)
{
- int skip_sem = current->flags & PF_DUMPCORE;
+ struct mm_struct *mm = current->mm;
+ int skip_sem = (current->flags & PF_DUMPCORE) || !mm;
int status;
- struct mm_struct *mm = current->mm;
- OCFS_ASSERT(mm);
-
if (!skip_sem)
down_read(&mm->mmap_sem);
@@ -268,7 +266,14 @@
* with everything else */
status = ocfs2_buffer_lock_ctxt_insert(ctxt, target_inode,
target_binode);
- if (!status) {
+
+ /* knfsd, which lacks an mm, may call us to do I/O. Since the buffer
+ * is private to the kernel, there isn't any need to insert any other
+ * locks, so we can skip it.
+ *
+ * The pile of duct tape and mixed nuts that is NFS 1, universe 0
+ */
+ if (!status && mm) {
/* Now fill the tree with any inodes that back this
* buffer. If target inode is in there, it will be
* skipped over. */
Modified: trunk/fs/ocfs2/namei.c
===================================================================
--- trunk/fs/ocfs2/namei.c 2005-04-01 23:32:39 UTC (rev 2101)
+++ trunk/fs/ocfs2/namei.c 2005-04-02 06:06:41 UTC (rev 2102)
@@ -188,6 +188,60 @@
return ret;
} /* ocfs_lookup */
+/*
+ * ocfs_get_parent
+ *
+ */
+struct dentry *ocfs_get_parent(struct dentry *child)
+{
+ int status;
+ u64 blkno;
+ struct dentry *parent;
+ struct inode *inode;
+ struct inode *dir = child->d_inode;
+ struct super_block *sb = dir->i_sb;
+ ocfs_super *osb = OCFS_SB(sb);
+ struct buffer_head *dirent_bh = NULL;
+ struct ocfs2_dir_entry *dirent;
+
+ LOG_SET_CONTEXT(LOOKUP);
+
+ LOG_ENTRY_ARGS ("(0x%p, '%.*s')\n", child,
+ child->d_name.len, child->d_name.name);
+
+ LOG_TRACE_ARGS("about to call find_files_on_disk with inode=%p\n",
+ dir);
+
+ status = ocfs_find_files_on_disk(osb, "..", 2, &blkno,
+ dir, 1, &dirent_bh, &dirent);
+ if (status < 0) {
+ parent = ERR_PTR(-ENOENT);
+ goto bail;
+ }
+
+ inode = ocfs_iget(osb, blkno);
+ if (!inode) {
+ LOG_ERROR_STR("Could not create inode!");
+ parent = ERR_PTR(-EACCES);
+ goto bail;
+ }
+
+ parent = d_alloc_anon(inode);
+ if (!parent) {
+ iput(inode);
+ parent = ERR_PTR(-ENOMEM);
+ }
+
+bail:
+ if (dirent_bh)
+ brelse(dirent_bh);
+
+ LOG_EXIT_PTR (parent);
+
+ LOG_CLEAR_CONTEXT();
+ return parent;
+} /* ocfs_get_parent */
+
static int ocfs_fill_new_dir(ocfs_super *osb,
ocfs_journal_handle *handle,
struct inode *parent,
Modified: trunk/fs/ocfs2/super.c
===================================================================
--- trunk/fs/ocfs2/super.c 2005-04-01 23:32:39 UTC (rev 2101)
+++ trunk/fs/ocfs2/super.c 2005-04-02 06:06:41 UTC (rev 2102)
@@ -170,6 +170,11 @@
};
+struct dentry *ocfs_get_parent(struct dentry *child);
+struct export_operations ocfs_export_ops = {
+ .get_parent = ocfs_get_parent,
+};
+
/*
* write_super and sync_fs ripped right out of ext3.
*/
@@ -366,6 +371,7 @@
sb->s_magic = OCFS2_SUPER_MAGIC;
sb->s_op = &ocfs_sops;
+ sb->s_export_op = &ocfs_export_ops;
sb->s_flags |= MS_NOATIME;
status = ocfs_mount_volume (sb, reclaim_id, NULL);
More information about the Ocfs2-commits
mailing list