lkml.org 
[lkml]   [2012]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 21/25] gfs2: use i_op->atomic_create()
Date
From: Miklos Szeredi <mszeredi@suse.cz>

GFS2 doesn't open the file in ->create, but it does check the LOOKUP_EXCL flag
in it's create function. Convert to using ->atomic_create and checking O_EXCL
so that the nameidata argument is no longer necessary.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
---
fs/gfs2/inode.c | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 5698746..203ec3c 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -754,13 +754,21 @@ fail:
* Returns: errno
*/

-static int gfs2_create(struct inode *dir, struct dentry *dentry,
- umode_t mode, struct nameidata *nd)
+static struct file *gfs2_create(struct inode *dir, struct dentry *dentry,
+ struct opendata *od, unsigned open_flag,
+ umode_t mode)
{
- int excl = 0;
- if (nd && (nd->flags & LOOKUP_EXCL))
+ int err;
+ int excl = 0; /* Why is excl not the default? */
+
+ if (od && (open_flag & O_EXCL))
excl = 1;
- return gfs2_create_inode(dir, dentry, S_IFREG | mode, 0, NULL, 0, excl);
+
+ err = gfs2_create_inode(dir, dentry, S_IFREG | mode, 0, NULL, 0, excl);
+ if (err)
+ return ERR_PTR(err);
+
+ return NULL;
}

/**
@@ -1809,7 +1817,7 @@ const struct inode_operations gfs2_file_iops = {
};

const struct inode_operations gfs2_dir_iops = {
- .create = gfs2_create,
+ .atomic_create = gfs2_create,
.lookup = gfs2_lookup,
.link = gfs2_link,
.unlink = gfs2_unlink,
--
1.7.7


\
 
 \ /
  Last update: 2012-03-07 22:27    [W:0.683 / U:0.712 seconds]
©2003-2014 Jasper Spaans. hosted at Digital Ocean