Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 03f0e022 authored by Aneesh Kumar K.V's avatar Aneesh Kumar K.V Committed by Eric Van Hensbergen
Browse files

fs/9p: Don't use O_TRUNC flag in TOPEN and TLOPEN request



We do the truncate via setattr request, hence don't pass the O_TRUNC flag in
open request. Without this patch we end up sending zero sized write request
to server when we try to truncate. Some servers (VirtFS) were not handling that
properly.

Reported-by: default avatarM. Mohan Kumar <mohan@in.ibm.com>
Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: default avatarEric Van Hensbergen <ericvh@gmail.com>
parent 7ffdea7e
Loading
Loading
Loading
Loading
+0 −4
Original line number Original line Diff line number Diff line
@@ -80,10 +80,6 @@ int v9fs_file_open(struct inode *inode, struct file *file)
			p9_client_clunk(fid);
			p9_client_clunk(fid);
			return err;
			return err;
		}
		}
		if (file->f_flags & O_TRUNC) {
			i_size_write(inode, 0);
			inode->i_blocks = 0;
		}
		if ((file->f_flags & O_APPEND) &&
		if ((file->f_flags & O_APPEND) &&
			(!v9fs_proto_dotu(v9ses) && !v9fs_proto_dotl(v9ses)))
			(!v9fs_proto_dotu(v9ses) && !v9fs_proto_dotl(v9ses)))
			generic_file_llseek(file, 0, SEEK_END);
			generic_file_llseek(file, 0, SEEK_END);
+0 −3
Original line number Original line Diff line number Diff line
@@ -192,9 +192,6 @@ int v9fs_uflags2omode(int uflags, int extended)
		break;
		break;
	}
	}


	if (uflags & O_TRUNC)
		ret |= P9_OTRUNC;

	if (extended) {
	if (extended) {
		if (uflags & O_EXCL)
		if (uflags & O_EXCL)
			ret |= P9_OEXCL;
			ret |= P9_OEXCL;
+0 −1
Original line number Original line Diff line number Diff line
@@ -186,7 +186,6 @@ static int v9fs_mapped_dotl_flags(int flags)
		{ O_CREAT,	P9_DOTL_CREATE },
		{ O_CREAT,	P9_DOTL_CREATE },
		{ O_EXCL,	P9_DOTL_EXCL },
		{ O_EXCL,	P9_DOTL_EXCL },
		{ O_NOCTTY,	P9_DOTL_NOCTTY },
		{ O_NOCTTY,	P9_DOTL_NOCTTY },
		{ O_TRUNC,	P9_DOTL_TRUNC },
		{ O_APPEND,	P9_DOTL_APPEND },
		{ O_APPEND,	P9_DOTL_APPEND },
		{ O_NONBLOCK,	P9_DOTL_NONBLOCK },
		{ O_NONBLOCK,	P9_DOTL_NONBLOCK },
		{ O_DSYNC,	P9_DOTL_DSYNC },
		{ O_DSYNC,	P9_DOTL_DSYNC },