[PATCH 21/25] gfs2: use i_op->atomic_create()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Miklos Szeredi <mszeredi@xxxxxxx>

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@xxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux