From patchwork Tue Feb 5 05:56:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aneesh Kumar K.V" X-Patchwork-Id: 2096331 Return-Path: X-Original-To: patchwork-v9fs-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by patchwork1.kernel.org (Postfix) with ESMTP id 17BE33FC23 for ; Tue, 5 Feb 2013 05:57:00 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-3.v29.ch3.sourceforge.com) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1U2bWc-0004KT-A9; Tue, 05 Feb 2013 05:56:58 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1U2bWa-0004KH-MI for v9fs-developer@lists.sourceforge.net; Tue, 05 Feb 2013 05:56:56 +0000 X-ACL-Warn: Received: from e28smtp09.in.ibm.com ([122.248.162.9]) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1U2bWY-00071W-LM for v9fs-developer@lists.sourceforge.net; Tue, 05 Feb 2013 05:56:56 +0000 Received: from /spool/local by e28smtp09.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 5 Feb 2013 11:25:15 +0530 Received: from d28dlp03.in.ibm.com (9.184.220.128) by e28smtp09.in.ibm.com (192.168.1.139) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 5 Feb 2013 11:25:08 +0530 Received: from d28relay04.in.ibm.com (d28relay04.in.ibm.com [9.184.220.61]) by d28dlp03.in.ibm.com (Postfix) with ESMTP id 2E8A61258053 for ; Tue, 5 Feb 2013 11:27:12 +0530 (IST) Received: from d28av05.in.ibm.com (d28av05.in.ibm.com [9.184.220.67]) by d28relay04.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r155uYpN3866764 for ; Tue, 5 Feb 2013 11:26:35 +0530 Received: from d28av05.in.ibm.com (loopback [127.0.0.1]) by d28av05.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r155uZxF019199 for ; Tue, 5 Feb 2013 16:56:35 +1100 Received: from skywalker.in.ibm.com (skywalker.in.ibm.com [9.124.35.88]) by d28av05.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r155uYRe019108; Tue, 5 Feb 2013 16:56:34 +1100 From: "Aneesh Kumar K.V" To: v9fs-developer@lists.sourceforge.net Date: Tue, 5 Feb 2013 11:26:28 +0530 Message-Id: <1360043788-17336-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.10 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13020505-2674-0000-0000-000007B92193 X-Spam-Score: -0.0 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain X-Headers-End: 1U2bWY-00071W-LM Subject: [V9fs-developer] [PATCH] fs/9p: Don't use O_TRUNC flag in TOPEN and TLOPEN request X-BeenThere: v9fs-developer@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: v9fs-developer-bounces@lists.sourceforge.net From: "Aneesh Kumar K.V" 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: M. Mohan Kumar Signed-off-by: Aneesh Kumar K.V --- fs/9p/vfs_file.c | 4 ---- fs/9p/vfs_inode.c | 3 --- fs/9p/vfs_inode_dotl.c | 1 - 3 files changed, 8 deletions(-) diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index 3356e3e..9aa559d 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c @@ -80,10 +80,6 @@ int v9fs_file_open(struct inode *inode, struct file *file) p9_client_clunk(fid); return err; } - if (file->f_flags & O_TRUNC) { - i_size_write(inode, 0); - inode->i_blocks = 0; - } if ((file->f_flags & O_APPEND) && (!v9fs_proto_dotu(v9ses) && !v9fs_proto_dotl(v9ses))) generic_file_llseek(file, 0, SEEK_END); diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 890bed5..57d017a 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c @@ -192,9 +192,6 @@ int v9fs_uflags2omode(int uflags, int extended) break; } - if (uflags & O_TRUNC) - ret |= P9_OTRUNC; - if (extended) { if (uflags & O_EXCL) ret |= P9_OEXCL; diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c index 7c29558..3eaca8b 100644 --- a/fs/9p/vfs_inode_dotl.c +++ b/fs/9p/vfs_inode_dotl.c @@ -186,7 +186,6 @@ static int v9fs_mapped_dotl_flags(int flags) { O_CREAT, P9_DOTL_CREATE }, { O_EXCL, P9_DOTL_EXCL }, { O_NOCTTY, P9_DOTL_NOCTTY }, - { O_TRUNC, P9_DOTL_TRUNC }, { O_APPEND, P9_DOTL_APPEND }, { O_NONBLOCK, P9_DOTL_NONBLOCK }, { O_DSYNC, P9_DOTL_DSYNC },