Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp21762514ybl; Mon, 6 Jan 2020 10:43:05 -0800 (PST) X-Google-Smtp-Source: APXvYqzCQrcqqQ456iyn8iJIqzhQwd9UKv3xa4gcBl4IpScj8LaJrJU0xgCAQuIWS365ZBA4ZBWF X-Received: by 2002:a9d:62c7:: with SMTP id z7mr107563673otk.189.1578336185574; Mon, 06 Jan 2020 10:43:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578336185; cv=none; d=google.com; s=arc-20160816; b=dE07KiWe2kINmd/4CIEnL7lLEqKDAtRIkd+c+7DtbXu8om8AFOPaI9DmKWqBDXMiYW nTgQ5Y24rYjci4MOH8h3lB88rMJAAHSg4urAfsRYGZq4H33fAUpiAYYcDQwuaDr7bd8c g6wrGrllZ9o+IkWZF+CjQBFoxpdgfzn3sJwTPlgCgEvKZ9ypmEL6JB00x1tsGFJ6bBj+ yajJeN63/t2IxR2xUsny9h+zHVl874W2tFDqJ6JA6eWLvtGhvHji/B7gRSoy2oSe9uKK 7UnfDxp/MHDu1Z8e1sbtw5PkQRtd5Z86a90MbfvNGWKSSU/UAcaOUvrf76bfhfasgRjK AYtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kBM4GM4ScWgAI2ERG7Edy0voI9DiPcQQJ6qVFwzJ0jQ=; b=qhEOMP/PpuzrnRUp5RXV4vkNXVyviDxE+Q7i6BOH82Nj8zUReXeWYPKBQ5gBHSfpDw Y8tpHaA4SMBVyzQv17ION86p5MQlqXVQfFUyacX4MaLlE9MIlnzCcMHa8y79TwJg9/vK q4/UUGFgI72dGKp8E0jScbXnRjoOdHm8umubM8jQXSAoKqVaQSTZUdyl0ROdXI8Fyadl +ZN3fAAPsltZyVm79XtZ1pMUKwpqaCgT4DfXOirk1vEAKZ5xiNu/FW1TrgMvBs6EkpSR IOV7BqMxHtO47E/eXb/Dkw5+Rl5UQNtt6oSIceetAq4InJqviv0m385Y9NXRqo9dXKuY Bchg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VzzY4qIP; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g9si35496691otq.68.2020.01.06.10.42.52; Mon, 06 Jan 2020 10:43:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VzzY4qIP; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726722AbgAFSmt (ORCPT + 99 others); Mon, 6 Jan 2020 13:42:49 -0500 Received: from mail-yb1-f195.google.com ([209.85.219.195]:39235 "EHLO mail-yb1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726612AbgAFSms (ORCPT ); Mon, 6 Jan 2020 13:42:48 -0500 Received: by mail-yb1-f195.google.com with SMTP id b12so137613ybg.6 for ; Mon, 06 Jan 2020 10:42:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kBM4GM4ScWgAI2ERG7Edy0voI9DiPcQQJ6qVFwzJ0jQ=; b=VzzY4qIPFi3m+IhfX0DE9QA/iIcZJN7jPWvU+v/IMOf0ZbwFpbS3Z/xa2tGzaMvDHq E2BCKYmjhhqkfb/Z58OWwtynUktJF0MTbS8bbCzq6S0KpvyW7ZekjPwjj9jP0qoa2aqz zcz7Llk3PhsV9dh6LGkpdgIdZ6N2riK2t3Js7ElaZ0scBVuY/TDSnffo/Kb6+YUPz7Cu MS1ihBAOrsAWFCzNSAUzYEyormazMR9vl0GG5UMBzzZvnx9Zjv1fs+z2gKYy+uyot/9Y w1id2k7oZFozqxx5iYJQhlo4uKChWisW8DodykVtGffssP/5ma7xirc9xuLGu/GFPjG+ jHnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kBM4GM4ScWgAI2ERG7Edy0voI9DiPcQQJ6qVFwzJ0jQ=; b=j8c5ApEJqFwr5W4bE9V9GF0DRdMNeaFJMzn7iUtLAB+qt6cqSnTaviUBCAXu9w4lpP WMO2ektew+TaokjNybA5EaFp2dMo2bwcqS4vPUDAjJTzG0mJA8zCKNPrg6AkrH1pD25t GkNWuT3WaG8YPj/5jDtFkzL/Tr+tG3ABDjT/Rkv0c7zUrUn1nVat0F5lkTBqjKHfLeDG qPV0v8XN0SNODdTU6vcQTDy9jN6h93uQ3vPdIP02IN49Dv85YeyUMk1h/x0zireFtdhc VJ/Po4GPo6Ie3d/OmOTE+ih5buDHAhtSPdyqmoh4DMT8fQzwNumIvgkvCtzrqjZqduEO WAPA== X-Gm-Message-State: APjAAAVCoMIw5UQrnM1DpwHxhj7GHBjhJml6axabaqo5yVMCmiYmpKhX Y/+4jxjxu6yxRgS0f/cBPw== X-Received: by 2002:a5b:bc2:: with SMTP id c2mr50625876ybr.372.1578336167632; Mon, 06 Jan 2020 10:42:47 -0800 (PST) Received: from localhost.localdomain (c-68-40-189-247.hsd1.mi.comcast.net. [68.40.189.247]) by smtp.gmail.com with ESMTPSA id u136sm28223497ywf.101.2020.01.06.10.42.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2020 10:42:47 -0800 (PST) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: "J. Bruce Fields" Cc: linux-nfs@vger.kernel.org Subject: [PATCH 1/9] nfsd: Allow nfsd_vfs_write() to take the nfsd_file as an argument Date: Mon, 6 Jan 2020 13:40:29 -0500 Message-Id: <20200106184037.563557-2-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200106184037.563557-1-trond.myklebust@hammerspace.com> References: <20200106184037.563557-1-trond.myklebust@hammerspace.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Needed in order to fix stable writes. Signed-off-by: Trond Myklebust --- fs/nfsd/nfs4proc.c | 2 +- fs/nfsd/vfs.c | 5 +++-- fs/nfsd/vfs.h | 4 +++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 4798667af647..3d4e78118e53 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -1012,7 +1012,7 @@ nfsd4_write(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, &write->wr_head, write->wr_buflen); WARN_ON_ONCE(nvecs > ARRAY_SIZE(rqstp->rq_vec)); - status = nfsd_vfs_write(rqstp, &cstate->current_fh, nf->nf_file, + status = nfsd_vfs_write(rqstp, &cstate->current_fh, nf, write->wr_offset, rqstp->rq_vec, nvecs, &cnt, write->wr_how_written); nfsd_file_put(nf); diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 82cf80dde5c7..69cbdb62b262 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -947,10 +947,11 @@ static int wait_for_concurrent_writes(struct file *file) } __be32 -nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, +nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct nfsd_file *nf, loff_t offset, struct kvec *vec, int vlen, unsigned long *cnt, int stable) { + struct file *file = nf->nf_file; struct svc_export *exp; struct iov_iter iter; __be32 nfserr; @@ -1057,7 +1058,7 @@ nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t offset, if (err) goto out; - err = nfsd_vfs_write(rqstp, fhp, nf->nf_file, offset, vec, + err = nfsd_vfs_write(rqstp, fhp, nf, offset, vec, vlen, cnt, stable); nfsd_file_put(nf); out: diff --git a/fs/nfsd/vfs.h b/fs/nfsd/vfs.h index cc110a10bfe8..fd779c3bb35b 100644 --- a/fs/nfsd/vfs.h +++ b/fs/nfsd/vfs.h @@ -34,6 +34,8 @@ #define NFSD_MAY_CREATE (NFSD_MAY_EXEC|NFSD_MAY_WRITE) #define NFSD_MAY_REMOVE (NFSD_MAY_EXEC|NFSD_MAY_WRITE|NFSD_MAY_TRUNC) +struct nfsd_file; + /* * Callback function for readdir */ @@ -93,7 +95,7 @@ __be32 nfsd_read(struct svc_rqst *, struct svc_fh *, __be32 nfsd_write(struct svc_rqst *, struct svc_fh *, loff_t, struct kvec *, int, unsigned long *, int); __be32 nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, - struct file *file, loff_t offset, + struct nfsd_file *nf, loff_t offset, struct kvec *vec, int vlen, unsigned long *cnt, int stable); __be32 nfsd_readlink(struct svc_rqst *, struct svc_fh *, -- 2.24.1