Commit 6beef7eb authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs:
  9p: fix O_APPEND in legacy mode
parents 494de900 2e4bef41
...@@ -51,4 +51,4 @@ int v9fs_dir_release(struct inode *inode, struct file *filp); ...@@ -51,4 +51,4 @@ int v9fs_dir_release(struct inode *inode, struct file *filp);
int v9fs_file_open(struct inode *inode, struct file *file); int v9fs_file_open(struct inode *inode, struct file *file);
void v9fs_inode2stat(struct inode *inode, struct p9_stat *stat); void v9fs_inode2stat(struct inode *inode, struct p9_stat *stat);
void v9fs_dentry_release(struct dentry *); void v9fs_dentry_release(struct dentry *);
int v9fs_uflags2omode(int uflags); int v9fs_uflags2omode(int uflags, int extended);
...@@ -59,7 +59,7 @@ int v9fs_file_open(struct inode *inode, struct file *file) ...@@ -59,7 +59,7 @@ int v9fs_file_open(struct inode *inode, struct file *file)
P9_DPRINTK(P9_DEBUG_VFS, "inode: %p file: %p \n", inode, file); P9_DPRINTK(P9_DEBUG_VFS, "inode: %p file: %p \n", inode, file);
v9ses = v9fs_inode2v9ses(inode); v9ses = v9fs_inode2v9ses(inode);
omode = v9fs_uflags2omode(file->f_flags); omode = v9fs_uflags2omode(file->f_flags, v9fs_extended(v9ses));
fid = file->private_data; fid = file->private_data;
if (!fid) { if (!fid) {
fid = v9fs_fid_clone(file->f_path.dentry); fid = v9fs_fid_clone(file->f_path.dentry);
...@@ -75,6 +75,8 @@ int v9fs_file_open(struct inode *inode, struct file *file) ...@@ -75,6 +75,8 @@ int v9fs_file_open(struct inode *inode, struct file *file)
inode->i_size = 0; inode->i_size = 0;
inode->i_blocks = 0; inode->i_blocks = 0;
} }
if ((file->f_flags & O_APPEND) && (!v9fs_extended(v9ses)))
generic_file_llseek(file, 0, SEEK_END);
} }
file->private_data = fid; file->private_data = fid;
......
...@@ -132,10 +132,10 @@ static int p9mode2unixmode(struct v9fs_session_info *v9ses, int mode) ...@@ -132,10 +132,10 @@ static int p9mode2unixmode(struct v9fs_session_info *v9ses, int mode)
/** /**
* v9fs_uflags2omode- convert posix open flags to plan 9 mode bits * v9fs_uflags2omode- convert posix open flags to plan 9 mode bits
* @uflags: flags to convert * @uflags: flags to convert
* * @extended: if .u extensions are active
*/ */
int v9fs_uflags2omode(int uflags) int v9fs_uflags2omode(int uflags, int extended)
{ {
int ret; int ret;
...@@ -155,14 +155,16 @@ int v9fs_uflags2omode(int uflags) ...@@ -155,14 +155,16 @@ int v9fs_uflags2omode(int uflags)
break; break;
} }
if (uflags & O_EXCL)
ret |= P9_OEXCL;
if (uflags & O_TRUNC) if (uflags & O_TRUNC)
ret |= P9_OTRUNC; ret |= P9_OTRUNC;
if (extended) {
if (uflags & O_EXCL)
ret |= P9_OEXCL;
if (uflags & O_APPEND) if (uflags & O_APPEND)
ret |= P9_OAPPEND; ret |= P9_OAPPEND;
}
return ret; return ret;
} }
...@@ -506,7 +508,7 @@ v9fs_vfs_create(struct inode *dir, struct dentry *dentry, int mode, ...@@ -506,7 +508,7 @@ v9fs_vfs_create(struct inode *dir, struct dentry *dentry, int mode,
flags = O_RDWR; flags = O_RDWR;
fid = v9fs_create(v9ses, dir, dentry, NULL, perm, fid = v9fs_create(v9ses, dir, dentry, NULL, perm,
v9fs_uflags2omode(flags)); v9fs_uflags2omode(flags, v9fs_extended(v9ses)));
if (IS_ERR(fid)) { if (IS_ERR(fid)) {
err = PTR_ERR(fid); err = PTR_ERR(fid);
fid = NULL; fid = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment