Skip to contentSkip to conversation

fs/9p: Update TLCREATE to allow create without open

PATCH In review Aneesh Kumar K.V 3 participants 11 messages Oct 5, 2010 – Oct 6, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 fs/9p: Update TLCREATE to allow create without open

We need this so that we can support regular file creation with mknod

---
 fs/9p/v9fs.h            |    2 ++
 fs/9p/vfs_inode.c       |   13 +++++++------
 include/net/9p/client.h |    2 +-
 net/9p/client.c         |    6 +++---
 4 files changed, 13 insertions(+), 10 deletions(-)
fs/9p/v9fs.h +2 -0
index 8bb7792..6209a29 100644
@@ -126,6 +126,8 @@ void v9fs_session_begin_cancel(struct v9fs_session_info *v9ses);
 #define V9FS_DEFUID	(-2)
 #define V9FS_DEFGID	(-2)
 
+#define P9_LOOKUP_OPEN 0x1
+
 static inline struct v9fs_session_info *v9fs_inode2v9ses(struct inode *inode)
 {
 	return (inode->i_sb->s_fs_info);
fs/9p/vfs_inode.c +7 -6
index 2f904a8..1ec9075 100644
@@ -668,8 +668,9 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
 	int err = 0;
 	char *name = NULL;
 	gid_t gid;
-	int flags;
+	int flags = 0;
 	mode_t mode;
+	int lookup_flags = 0;
 	struct v9fs_session_info *v9ses;
 	struct p9_fid *fid = NULL;
 	struct p9_fid *dfid, *ofid;
@@ -679,11 +680,10 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
 	struct posix_acl *pacl = NULL, *dacl = NULL;
 
 	v9ses = v9fs_inode2v9ses(dir);
-	if (nd && nd->flags & LOOKUP_OPEN)
+	if (nd && nd->flags & LOOKUP_OPEN) {
 		flags = nd->intent.open.flags - 1;
-	else
-		flags = O_RDWR;
-
+		lookup_flags = P9_LOOKUP_OPEN;
+	}
 	name = (char *) dentry->d_name.name;
 	P9_DPRINTK(P9_DEBUG_VFS, "v9fs_vfs_create_dotl: name:%s flags:0x%x "
 			"mode:0x%x\n", name, flags, omode);
@@ -713,7 +713,8 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
 			   "Failed to get acl values in creat %d\n", err);
 		goto error;
 	}
-	err = p9_client_create_dotl(ofid, name, flags, mode, gid, &qid);
+	err = p9_client_create_dotl(ofid, name, flags, mode,
+				    gid, lookup_flags, &qid);
 	if (err < 0) {
 		P9_DPRINTK(P9_DEBUG_VFS,
 				"p9_client_open_dotl failed in creat %d\n",
include/net/9p/client.h +1 -1
index fb358f5..b0b97ec 100644
@@ -230,7 +230,7 @@ int p9_client_link(struct p9_fid *fid, struct p9_fid *oldfid, char *newname);
 int p9_client_symlink(struct p9_fid *fid, char *name, char *symname, gid_t gid,
 							struct p9_qid *qid);
 int p9_client_create_dotl(struct p9_fid *ofid, char *name, u32 flags, u32 mode,
-		gid_t gid, struct p9_qid *qid);
+			  gid_t gid, int lookup_flags, struct p9_qid *qid);
 int p9_client_clunk(struct p9_fid *fid);
 int p9_client_remove(struct p9_fid *fid);
 int p9_client_read(struct p9_fid *fid, char *data, char __user *udata,
net/9p/client.c +3 -3
index 4b90b82..9950275 100644
@@ -1070,7 +1070,7 @@ error:
 EXPORT_SYMBOL(p9_client_open);
 
 int p9_client_create_dotl(struct p9_fid *ofid, char *name, u32 flags, u32 mode,
-		gid_t gid, struct p9_qid *qid)
+			  gid_t gid, int lookup_flags, struct p9_qid *qid)
 {
 	int err = 0;
 	struct p9_client *clnt;
@@ -1085,8 +1085,8 @@ int p9_client_create_dotl(struct p9_fid *ofid, char *name, u32 flags, u32 mode,
 	if (ofid->mode != -1)
 		return -EINVAL;
 
-	req = p9_client_rpc(clnt, P9_TLCREATE, "dsddd", ofid->fid, name, flags,
-			mode, gid);
+	req = p9_client_rpc(clnt, P9_TLCREATE, "dsdddd", ofid->fid, name, flags,
+			    mode, gid, lookup_flags);
 	if (IS_ERR(req)) {
 		err = PTR_ERR(req);
 		goto error;
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH 2/3 fs/9p: Add missing iput in v9fs_vfs_lookup

Make sure we drop inode reference in the error path

---
 fs/9p/vfs_inode.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
fs/9p/vfs_inode.c +3 -1
index 1ec9075..1ac9229 100644
@@ -1028,7 +1028,7 @@ static struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
 
 	result = v9fs_fid_add(dentry, fid);
 	if (result < 0)
-		goto error;
+		goto error_iput;
 
 inst_out:
 	if (v9ses->cache)
@@ -1039,6 +1039,8 @@ inst_out:
 	d_add(dentry, inode);
 	return NULL;
 
+error_iput:
+	iput(inode);
 error:
 	p9_client_clunk(fid);
 
Signature · 1 line
1.7.0.4
Reviewed-by on v1 2/3
#2 lore raw

Re: [V9fs-developer] [PATCH 2/3] fs/9p: Add missing iput in v9fs_vfs_lookup

Quoted 3 lines · Aneesh Kumar K.V

Make sure we drop inode reference in the error path

Looks good to me.

Quoted 26 lines
---
  fs/9p/vfs_inode.c |    4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)
fs/9p/vfs_inode.c +3 -1
index 1ec9075..1ac9229 100644
@@ -1028,7 +1028,7 @@ static struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
 
  	result = v9fs_fid_add(dentry, fid);
  	if (result<  0)
-		goto error;
+		goto error_iput;
 
  inst_out:
  	if (v9ses->cache)
@@ -1039,6 +1039,8 @@ inst_out:
  	d_add(dentry, inode);
  	return NULL;
 
+error_iput:
+	iput(inode);
  error:
  	p9_client_clunk(fid);
 
#3 lore raw

PATCH 3/3 fs/9p: Use generic_file_open with lookup_instantiate_filp

In reply to Aneesh Kumar K.V

We need to do O_LARGEFILE check even in case of 9p. Use the generic_file_open helper

---
 fs/9p/vfs_inode.c |   11 ++---------
 1 files changed, 2 insertions(+), 9 deletions(-)
fs/9p/vfs_inode.c +2 -9
index 1ac9229..44ce77d 100644
@@ -560,13 +560,6 @@ static int v9fs_remove(struct inode *dir, struct dentry *file, int rmdir)
 	return retval;
 }
 
-static int
-v9fs_open_created(struct inode *inode, struct file *file)
-{
-	return 0;
-}
-
-
 /**
  * v9fs_create - Create a file
  * @v9ses: session information
@@ -766,7 +759,7 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
 
 	/* if we are opening a file, assign the open fid to the file */
 	if (nd && nd->flags & LOOKUP_OPEN) {
-		filp = lookup_instantiate_filp(nd, dentry, v9fs_open_created);
+		filp = lookup_instantiate_filp(nd, dentry, generic_file_open);
 		if (IS_ERR(filp)) {
 			p9_client_clunk(ofid);
 			return PTR_ERR(filp);
@@ -825,7 +818,7 @@ v9fs_vfs_create(struct inode *dir, struct dentry *dentry, int mode,
 
 	/* if we are opening a file, assign the open fid to the file */
 	if (nd && nd->flags & LOOKUP_OPEN) {
-		filp = lookup_instantiate_filp(nd, dentry, v9fs_open_created);
+		filp = lookup_instantiate_filp(nd, dentry, generic_file_open);
 		if (IS_ERR(filp)) {
 			err = PTR_ERR(filp);
 			goto error;
Signature · 1 line
1.7.0.4
#4 lore raw

Re: [V9fs-developer] [PATCH 3/3] fs/9p: Use generic_file_open with lookup_instantiate_filp

Quoted 4 lines · Aneesh Kumar K.V

We need to do O_LARGEFILE check even in case of 9p. Use the generic_file_open helper

Looks good to me

Reviewed by : Venkateswararao Jujjuri <[email protected]>

Quoted 40 lines
---
  fs/9p/vfs_inode.c |   11 ++---------
  1 files changed, 2 insertions(+), 9 deletions(-)
fs/9p/vfs_inode.c +2 -9
index 1ac9229..44ce77d 100644
@@ -560,13 +560,6 @@ static int v9fs_remove(struct inode *dir, struct dentry *file, int rmdir)
  	return retval;
  }
 
-static int
-v9fs_open_created(struct inode *inode, struct file *file)
-{
-	return 0;
-}
-
-
  /**
   * v9fs_create - Create a file
   * @v9ses: session information
@@ -766,7 +759,7 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
 
  	/* if we are opening a file, assign the open fid to the file */
  	if (nd&&  nd->flags&  LOOKUP_OPEN) {
-		filp = lookup_instantiate_filp(nd, dentry, v9fs_open_created);
+		filp = lookup_instantiate_filp(nd, dentry, generic_file_open);
  		if (IS_ERR(filp)) {
  			p9_client_clunk(ofid);
  			return PTR_ERR(filp);
@@ -825,7 +818,7 @@ v9fs_vfs_create(struct inode *dir, struct dentry *dentry, int mode,
 
  	/* if we are opening a file, assign the open fid to the file */
  	if (nd&&  nd->flags&  LOOKUP_OPEN) {
-		filp = lookup_instantiate_filp(nd, dentry, v9fs_open_created);
+		filp = lookup_instantiate_filp(nd, dentry, generic_file_open);
  		if (IS_ERR(filp)) {
  			err = PTR_ERR(filp);
  			goto error;
#5 lore raw
In reply to Aneesh Kumar K.V

Ouch. Protocol change.

Also - not sure I understand what's going on here. Why does mknod go through TLCREATE, shouldn't we have our
own protocol messages for mknod?//

Why add an additional flag field instead of just using the existing flags field since we are only talking about a bit?

-eric

Quoted 116 lines · Aneesh Kumar K.V

We need this so that we can support regular file creation with mknod

---
 fs/9p/v9fs.h            |    2 ++
 fs/9p/vfs_inode.c       |   13 +++++++------
 include/net/9p/client.h |    2 +-
 net/9p/client.c         |    6 +++---

 4 files changed, 13 insertions(+), 10 deletions(-)
fs/9p/v9fs.h +2 -0
index 8bb7792..6209a29 100644
@@ -126,6 +126,8 @@ void v9fs_session_begin_cancel(struct v9fs_session_info *v9ses);
  #define V9FS_DEFUID    (-2)
  #define V9FS_DEFGID    (-2)
 
+#define P9_LOOKUP_OPEN 0x1
+
  static inline struct v9fs_session_info *v9fs_inode2v9ses(struct inode *inode)
  {
        return (inode->i_sb->s_fs_info);
fs/9p/vfs_inode.c +5 -5
index 2f904a8..1ec9075 100644
@@ -668,8 +668,9 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
        int err = 0;
        char *name = NULL;
        gid_t gid;
-       int flags;
+       int flags = 0;
        mode_t mode;
+       int lookup_flags = 0;
        struct v9fs_session_info *v9ses;
        struct p9_fid *fid = NULL;
        struct p9_fid *dfid, *ofid;
@@ -679,11 +680,10 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
        struct posix_acl *pacl = NULL, *dacl = NULL;
 
        v9ses = v9fs_inode2v9ses(dir);
-       if (nd && nd->flags & LOOKUP_OPEN)
+       if (nd && nd->flags & LOOKUP_OPEN) {
                flags = nd->intent.open.flags - 1;
-       else
-               flags = O_RDWR;
-
+               lookup_flags = P9_LOOKUP_OPEN;
+       }
        name = (char *) dentry->d_name.name;

       P9_DPRINTK(P9_DEBUG_VFS, "v9fs_vfs_create_dotl: name:%s flags:0x%x " "mode:0x%x\n", name, flags, omode);

fs/9p/vfs_inode.c +2 -1
@@ -713,7 +713,8 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
                           "Failed to get acl values in creat %d\n", err);
                goto error;
        }
-       err = p9_client_create_dotl(ofid, name, flags, mode, gid, &qid);
+       err = p9_client_create_dotl(ofid, name, flags, mode,
+                                   gid, lookup_flags, &qid);
        if (err < 0) {
                P9_DPRINTK(P9_DEBUG_VFS,
                                "p9_client_open_dotl failed in creat %d\n",
include/net/9p/client.h +1 -1
index fb358f5..b0b97ec 100644
@@ -230,7 +230,7 @@ int p9_client_link(struct p9_fid *fid, struct p9_fid *oldfid, char *newname);
  int p9_client_symlink(struct p9_fid *fid, char *name, char *symname, gid_t gid,
                                                        struct p9_qid *qid);
  int p9_client_create_dotl(struct p9_fid *ofid, char *name, u32 flags, u32 mode,
-               gid_t gid, struct p9_qid *qid);
+                         gid_t gid, int lookup_flags, struct p9_qid *qid);
  int p9_client_clunk(struct p9_fid *fid);
  int p9_client_remove(struct p9_fid *fid);
  int p9_client_read(struct p9_fid *fid, char *data, char __user *udata,
net/9p/client.c +3 -4
index 4b90b82..9950275 100644
@@ -1070,7 +1070,7 @@ error:
  EXPORT_SYMBOL(p9_client_open);
 
  int p9_client_create_dotl(struct p9_fid *ofid, char *name, u32 flags, u32 mode,
-               gid_t gid, struct p9_qid *qid)
+                         gid_t gid, int lookup_flags, struct p9_qid *qid)
  {
        int err = 0;
        struct p9_client *clnt;
@@ -1085,8 +1085,8 @@ int p9_client_create_dotl(struct p9_fid *ofid, char *name, u32 flags, u32 mode,
        if (ofid->mode != -1)
                return -EINVAL;
 
-       req = p9_client_rpc(clnt, P9_TLCREATE, "dsddd", ofid->fid, name, flags,
-                       mode, gid);
+       req = p9_client_rpc(clnt, P9_TLCREATE, "dsdddd", ofid->fid, name, flags,
+                           mode, gid, lookup_flags);
        if (IS_ERR(req)) {
                err = PTR_ERR(req);
                goto error;
--

1.7.0.4

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3. Spend less time writing and  rewriting code and more time creating great experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
V9fs-developer mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/v9fs-developer

#6 lore raw
Quoted 42 lines · Eric Van Hensbergen

Ouch. Protocol change.

Also - not sure I understand what's going on here. Why does mknod go through TLCREATE, shouldn't we have our
own protocol messages for mknod?//

Why add an additional flag field instead of just using the existing flags field since we are only talking about a bit?

-eric

Quoted 28 lines · Aneesh Kumar K.V

We need this so that we can support regular file creation with mknod

---
  fs/9p/v9fs.h            |    2 ++
  fs/9p/vfs_inode.c       |   13 +++++++------
  include/net/9p/client.h |    2 +-
  net/9p/client.c         |    6 +++---
  4 files changed, 13 insertions(+), 10 deletions(-)
fs/9p/v9fs.h +2 -0
index 8bb7792..6209a29 100644
@@ -126,6 +126,8 @@ void v9fs_session_begin_cancel(struct v9fs_session_info *v9ses);
  #define V9FS_DEFUID    (-2)
  #define V9FS_DEFGID    (-2)
 
+#define P9_LOOKUP_OPEN 0x1
+
  static inline struct v9fs_session_info *v9fs_inode2v9ses(struct inode *inode)
  {
        return (inode->i_sb->s_fs_info);
fs/9p/vfs_inode.c +0 -0
index 2f904a8..1ec9075 100644
Quoted 8 lines

fs/9p/vfs_inode.c v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode, · line 673

Quoted 8 lines
fs/9p/vfs_inode.c +2 -1
@@ -668,8 +668,9 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
        int err = 0;
        char *name = NULL;
        gid_t gid;
-       int flags;
+       int flags = 0;
        mode_t mode;
+       int lookup_flags = 0;

I think we decided to send -1 with the flags instead of doing protocol change here.

Thanks,
JV

Quoted 91 lines
Quoted 69 lines
fs/9p/vfs_inode.c +5 -5
        struct v9fs_session_info *v9ses;
        struct p9_fid *fid = NULL;
        struct p9_fid *dfid, *ofid;
@@ -679,11 +680,10 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
        struct posix_acl *pacl = NULL, *dacl = NULL;
 
        v9ses = v9fs_inode2v9ses(dir);
-       if (nd&&  nd->flags&  LOOKUP_OPEN)
+       if (nd&&  nd->flags&  LOOKUP_OPEN) {
                flags = nd->intent.open.flags - 1;
-       else
-               flags = O_RDWR;
-
+               lookup_flags = P9_LOOKUP_OPEN;
+       }
        name = (char *) dentry->d_name.name;
        P9_DPRINTK(P9_DEBUG_VFS, "v9fs_vfs_create_dotl: name:%s flags:0x%x "
                        "mode:0x%x\n", name, flags, omode);
@@ -713,7 +713,8 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
                           "Failed to get acl values in creat %d\n", err);
                goto error;
        }
-       err = p9_client_create_dotl(ofid, name, flags, mode, gid,&qid);
+       err = p9_client_create_dotl(ofid, name, flags, mode,
+                                   gid, lookup_flags,&qid);
        if (err<  0) {
                P9_DPRINTK(P9_DEBUG_VFS,
                                "p9_client_open_dotl failed in creat %d\n",
include/net/9p/client.h +1 -1
index fb358f5..b0b97ec 100644
@@ -230,7 +230,7 @@ int p9_client_link(struct p9_fid *fid, struct p9_fid *oldfid, char *newname);
  int p9_client_symlink(struct p9_fid *fid, char *name, char *symname, gid_t gid,
                                                        struct p9_qid *qid);
  int p9_client_create_dotl(struct p9_fid *ofid, char *name, u32 flags, u32 mode,
-               gid_t gid, struct p9_qid *qid);
+                         gid_t gid, int lookup_flags, struct p9_qid *qid);
  int p9_client_clunk(struct p9_fid *fid);
  int p9_client_remove(struct p9_fid *fid);
  int p9_client_read(struct p9_fid *fid, char *data, char __user *udata,
net/9p/client.c +3 -4
index 4b90b82..9950275 100644
@@ -1070,7 +1070,7 @@ error:
  EXPORT_SYMBOL(p9_client_open);
 
  int p9_client_create_dotl(struct p9_fid *ofid, char *name, u32 flags, u32 mode,
-               gid_t gid, struct p9_qid *qid)
+                         gid_t gid, int lookup_flags, struct p9_qid *qid)
  {
        int err = 0;
        struct p9_client *clnt;
@@ -1085,8 +1085,8 @@ int p9_client_create_dotl(struct p9_fid *ofid, char *name, u32 flags, u32 mode,
        if (ofid->mode != -1)
                return -EINVAL;
 
-       req = p9_client_rpc(clnt, P9_TLCREATE, "dsddd", ofid->fid, name, flags,
-                       mode, gid);
+       req = p9_client_rpc(clnt, P9_TLCREATE, "dsdddd", ofid->fid, name, flags,
+                           mode, gid, lookup_flags);
        if (IS_ERR(req)) {
                err = PTR_ERR(req);
                goto error;
--

1.7.0.4

Quoted 11 lines

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2& L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
V9fs-developer mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/v9fs-developer

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2& L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
V9fs-developer mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/v9fs-developer

#7 lore raw
In reply to Eric Van Hensbergen
Quoted 5 lines · Eric Van Hensbergen

Ouch. Protocol change.

Also - not sure I understand what's going on here. Why does mknod go through TLCREATE, shouldn't we have our
own protocol messages for mknod?//

This is needed for the below mknod usage

mknod("k2", S_IFREG) ;

Quoted 4 lines

Why add an additional flag field instead of just using the existing flags field since we are only talking about a bit?

TLCREATE is

size[4] Tlcreate tag[2] fid[4] name[s] flags[4] mode[4] gid[4]

size[4] Rlcreate tag[2] qid[13] iounit[4]

The flags argument represent Linux access mode flags with which the caller is requesting to open the file with. Protocol allows all the Linux access

Having a -1 with the flag would indicate all the access mode flags are set. So i found that to be ugly. And value 0 indicate O_RDONLY. So was not sure whether -1 in flags or having a separate lookup flags is the right thing to do.

-aneesh

#8 lore raw
Quoted 12 lines · Aneesh Kumar K. V
Quoted 5 lines · Eric Van Hensbergen

Ouch. Protocol change.

Also - not sure I understand what's going on here. Why does mknod go through TLCREATE, shouldn't we have our
own protocol messages for mknod?//

This is needed for the below mknod usage

mknod("k2", S_IFREG) ;

May be a better fix is to make sure we use TLMKNOD instead of TLCREATE in case we get a create without LOOKUP_OPEN flags set. So how about

fs/9p/vfs_inode.c +12 -2
index 2f904a8..e89754f 100644
@@ -55,6 +55,10 @@ static const struct inode_operations v9fs_file_inode_operations_dotl;
 static const struct inode_operations v9fs_symlink_inode_operations;
 static const struct inode_operations v9fs_symlink_inode_operations_dotl;
 
+static int
+v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode,
+		    dev_t rdev);
+
 /**
  * unixmode2p9mode - convert unix mode bits to plan 9
  * @v9ses: v9fs session information
@@ -681,8 +685,14 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
 	v9ses = v9fs_inode2v9ses(dir);
 	if (nd && nd->flags & LOOKUP_OPEN)
 		flags = nd->intent.open.flags - 1;
-	else
-		flags = O_RDWR;
+	else {
+		/*
+		 * create call without LOOKUP_OPEN is due
+		 * to mknod of regular files. So use mknod
+		 * operation.
+		 */
+		return v9fs_vfs_mknod_dotl(dir, dentry, omode, 0);
+	}
 
 	name = (char *) dentry->d_name.name;
 	P9_DPRINTK(P9_DEBUG_VFS, "v9fs_vfs_create_dotl: name:%s flags:0x%x "
#9 lore raw
Quoted 8 lines · Aneesh Kumar K. V
Quoted 7 lines · Aneesh Kumar K. V
Quoted 5 lines · Eric Van Hensbergen

Ouch. Protocol change.

Also - not sure I understand what's going on here. Why does mknod go through TLCREATE, shouldn't we have our
own protocol messages for mknod?//

Quoted 8 lines
Quoted 5 lines

This is needed for the below mknod usage

mknod("k2", S_IFREG) ;

May be a better fix is to make sure we use TLMKNOD instead of TLCREATE in case we get a create without LOOKUP_OPEN flags set. So how about

Yep. This sounds much better. :)

- JV

Quoted 44 lines
fs/9p/vfs_inode.c +12 -3
index 2f904a8..e89754f 100644
@@ -55,6 +55,10 @@ static const struct inode_operations v9fs_file_inode_operations_dotl;
  static const struct inode_operations v9fs_symlink_inode_operations;
  static const struct inode_operations v9fs_symlink_inode_operations_dotl;
 
+static int
+v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode,
+		    dev_t rdev);
+
  /**
   * unixmode2p9mode - convert unix mode bits to plan 9
   * @v9ses: v9fs session information
@@ -681,8 +685,14 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
  	v9ses = v9fs_inode2v9ses(dir);
  	if (nd&&  nd->flags&  LOOKUP_OPEN)
  		flags = nd->intent.open.flags - 1;
-	else
-		flags = O_RDWR;
+	else {
+		/*
+		 * create call without LOOKUP_OPEN is due
+		 * to mknod of regular files. So use mknod
+		 * operation.
+		 */
+		return v9fs_vfs_mknod_dotl(dir, dentry, omode, 0);
+	}
 
  	name = (char *) dentry->d_name.name;
  	P9_DPRINTK(P9_DEBUG_VFS, "v9fs_vfs_create_dotl: name:%s flags:0x%x "
 
------------------------------------------------------------------------------

Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2& L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
V9fs-developer mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/v9fs-developer

#10 lore raw
In reply to Aneesh Kumar K. V
Quoted 8 lines · Aneesh Kumar K. V
Quoted 7 lines · Aneesh Kumar K. V
Quoted 5 lines · Eric Van Hensbergen

Ouch.  Protocol change.

Also - not sure I understand what's going on here.  Why does mknod go through TLCREATE, shouldn't we have our
own protocol messages for mknod?//

Quoted 9 lines
Quoted 5 lines

This is needed for the below mknod usage

mknod("k2", S_IFREG) ;

May be a better fix is to make sure we use TLMKNOD instead of TLCREATE in case we get a create without LOOKUP_OPEN flags set. So how about

Yes, I think that's the better path. :)

-eric

Quoted 44 lines
fs/9p/vfs_inode.c +12 -2
index 2f904a8..e89754f 100644
@@ -55,6 +55,10 @@ static const struct inode_operations v9fs_file_inode_operations_dotl;
  static const struct inode_operations v9fs_symlink_inode_operations;
  static const struct inode_operations v9fs_symlink_inode_operations_dotl;
 
+static int
+v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode,
+                   dev_t rdev);
+
  /**
  * unixmode2p9mode - convert unix mode bits to plan 9
  * @v9ses: v9fs session information
@@ -681,8 +685,14 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
        v9ses = v9fs_inode2v9ses(dir);
        if (nd && nd->flags & LOOKUP_OPEN)
                flags = nd->intent.open.flags - 1;
-       else
-               flags = O_RDWR;
+       else {
+               /*
+                * create call without LOOKUP_OPEN is due
+                * to mknod of regular files. So use mknod
+                * operation.
+                */
+               return v9fs_vfs_mknod_dotl(dir, dentry, omode, 0);
+       }
 
        name = (char *) dentry->d_name.name;

       P9_DPRINTK(P9_DEBUG_VFS, "v9fs_vfs_create_dotl: name:%s flags:0x%x "

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3. Spend less time writing and  rewriting code and more time creating great experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
V9fs-developer mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/v9fs-developer