From patchwork Wed May 11 22:14:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Mkrtchyan, Tigran" X-Patchwork-Id: 9075261 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7B3B9BF29F for ; Wed, 11 May 2016 22:14:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B98B52017D for ; Wed, 11 May 2016 22:14:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 517322012B for ; Wed, 11 May 2016 22:14:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751676AbcEKWOR (ORCPT ); Wed, 11 May 2016 18:14:17 -0400 Received: from smtp-o-3.desy.de ([131.169.56.156]:44962 "EHLO smtp-o-3.desy.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751611AbcEKWOQ (ORCPT ); Wed, 11 May 2016 18:14:16 -0400 X-Clacks-Overhead: GNU Terry Pratchett Received: from smtp-map-3.desy.de (smtp-map-3.desy.de [131.169.56.68]) by smtp-o-3.desy.de (DESY-O-3) with ESMTP id B85962802A8 for ; Thu, 12 May 2016 00:14:13 +0200 (CEST) Received: from ZITSWEEP2.win.desy.de (zitsweep2.win.desy.de [131.169.97.96]) by smtp-map-3.desy.de (DESY_MAP_3) with ESMTP id AC75A1586 for ; Thu, 12 May 2016 00:14:13 +0200 (MEST) Received: from smtp-intra-3.desy.de (lb-40-26.desy.de) by ZITSWEEP2.win.desy.de (Clearswift SMTPRS 5.5.0) with ESMTP id ; Thu, 12 May 2016 00:14:13 +0200 Received: from anahit.desy.de (anahit.desy.de [131.169.185.68]) by smtp-intra-3.desy.de (DESY-INTRA-3) with ESMTP id DFC731586; Thu, 12 May 2016 00:14:12 +0200 (MEST) From: Tigran Mkrtchyan To: trond.myklebust@primarydata.com Cc: linux-nfs@vger.kernel.org, Tigran Mkrtchyan Subject: [PATCH] nfs4: client: do not send empty SETATTR after OPEN_CREATE Date: Thu, 12 May 2016 00:14:03 +0200 Message-Id: <1463004843-3733-1-git-send-email-tigran.mkrtchyan@desy.de> X-Mailer: git-send-email 2.5.5 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP OPEN_CREATE with EXCLUSIVE4_1 sends initial file permission. Ignoring fact, that server have indicated that file mod is set, client will send yet another SETATTR request, but, as mode is already set, new SETATTR will be empty. This is not a problem, nevertheless an extra roundtrip and slow open on high latency networks. This change is aims to by-pass setattr if there are no attributes defined. Signed-off-by: Tigran Mkrtchyan --- fs/nfs/nfs4proc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 327b8c3..f6b278f 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -2724,6 +2724,12 @@ static int nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred, .inode = inode, }; int err; + /* + * a shortcut: it there are no attributes to be updated, do not send setattr at all + */ + if (sattr->ia_valid == ATTR_OPEN) + return 0; + do { err = _nfs4_do_setattr(inode, cred, fattr, sattr, state, ilabel, olabel); switch (err) {