From patchwork Sat Dec 31 12:59:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kinglong Mee X-Patchwork-Id: 9492719 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 97B2362ABB for ; Sat, 31 Dec 2016 13:00:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8073F223A6 for ; Sat, 31 Dec 2016 13:00:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6255C24B44; Sat, 31 Dec 2016 13:00:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE5B0223A6 for ; Sat, 31 Dec 2016 13:00:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753797AbcLaNAI (ORCPT ); Sat, 31 Dec 2016 08:00:08 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:33177 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751264AbcLaNAH (ORCPT ); Sat, 31 Dec 2016 08:00:07 -0500 Received: by mail-pg0-f65.google.com with SMTP id g1so25052117pgn.0 for ; Sat, 31 Dec 2016 05:00:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:subject:to:cc:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=GcQJCSPUJ+5io9l3F8XQKXYgDkSKEc9pNbP9Z6WF9DE=; b=Fe5kSjk36JIc8WQgwWhGgaHxmK4u2H9QRvzT6nsIKxfPx2TtzROj44wBhu2KgS3NUx lk1a0+PB4aSryDlJoc2mtQlzDnJPWvfgSp+0IPTM6IdZgMgj550aWmYpYiLeISSIS161 0rIQ5LCx/3/4lcYeC+Za+GCLv5yn97sooUmdJvFna3ZY0GgKsJI9npHoB4JByFYRbVVR 1D4IDPTQ0DDpqpKVUqjoqN2sSZbM+7+jUw79K4zVAsr1excEGlThJrNYPhesDCP+SL/8 qcGIhJMgTWUUOrPkIe7WUthIOKWoNV/zlS6DCXlRW+NC+SYhmJk7Osa7/f4rH/6gV0MH dS6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=GcQJCSPUJ+5io9l3F8XQKXYgDkSKEc9pNbP9Z6WF9DE=; b=P3moOCbUZ7cBA+ZJ6oFEOdEuR5sqN6A/2a4xJjqqj3yuxKaAAFZc2w53ZsMCV4yY18 VRm/K4SlJY8LMXkFKq0Gw2B53uEkYqf2Qkm7IYq0h8wLOTwcmZgXGTt0218aZcGXR9Nx qokIJ0PfKYvqORl6Gx9FWcydHNNTceufDqp/ZHSbJSEx2Ys2l8Wg+7SUJxO2Gsgf5/HT omnvBn9tptg/wwp9ylJg92+jyOXe4X53fHkiCbUpxflgQlJZUjz2W0oWfZb1YOos5IA6 tl6zDof1XKlat8cVr4wrjSw0bNxO1U3Za7DfT2hxIM5alBj9AC5t579l8HCteooirB3f eVBw== X-Gm-Message-State: AIkVDXJXTjkXdXs7E8hLCz5A0HlpL33CFzdbvygY61KYA8x3/dAQijXxZrkd5g1nv1tIcw== X-Received: by 10.99.178.6 with SMTP id x6mr92774192pge.63.1483189206850; Sat, 31 Dec 2016 05:00:06 -0800 (PST) Received: from [192.168.0.104] ([183.228.30.39]) by smtp.googlemail.com with ESMTPSA id d186sm77497194pfd.5.2016.12.31.05.00.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 31 Dec 2016 05:00:06 -0800 (PST) From: Kinglong Mee Subject: [PATCH 1/3 v2] NFSD: pass an integer for stable type to nfsd_vfs_write To: "J. Bruce Fields" , linux-nfs@vger.kernel.org Cc: Christoph Hellwig , kinglongmee@gmail.com Message-ID: <49bb153b-091a-4c83-b782-2244d8eaab2a@gmail.com> Date: Sat, 31 Dec 2016 20:59:53 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Commit fae5096ad217 "nfsd: assume writeable exportabled filesystems have f_sync" have remove the setting of stable. Signed-off-by: Kinglong Mee --- fs/nfsd/nfs3proc.c | 2 +- fs/nfsd/nfs4proc.c | 2 +- fs/nfsd/nfs4xdr.c | 2 +- fs/nfsd/nfsproc.c | 3 +-- fs/nfsd/vfs.c | 11 +++++------ fs/nfsd/vfs.h | 4 ++-- 6 files changed, 11 insertions(+), 13 deletions(-) diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c index d818e4f..69cd0f1 100644 --- a/fs/nfsd/nfs3proc.c +++ b/fs/nfsd/nfs3proc.c @@ -197,7 +197,7 @@ nfsd3_proc_write(struct svc_rqst *rqstp, struct nfsd3_writeargs *argp, argp->offset, rqstp->rq_vec, argp->vlen, &cnt, - &resp->committed); + resp->committed); resp->count = cnt; RETURN_STATUS(nfserr); } diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 74a6e57..2d4eb47 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -983,7 +983,7 @@ nfsd4_write(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, status = nfsd_vfs_write(rqstp, &cstate->current_fh, filp, write->wr_offset, rqstp->rq_vec, nvecs, &cnt, - &write->wr_how_written); + write->wr_how_written); fput(filp); write->wr_bytes_written = cnt; diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 7ecf16b..3a02c9b 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -1250,7 +1250,7 @@ nfsd4_decode_write(struct nfsd4_compoundargs *argp, struct nfsd4_write *write) READ_BUF(16); p = xdr_decode_hyper(p, &write->wr_offset); write->wr_stable_how = be32_to_cpup(p++); - if (write->wr_stable_how > 2) + if (write->wr_stable_how > NFS_FILE_SYNC) goto xdr_error; write->wr_buflen = be32_to_cpup(p++); diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c index 010aff5..f157c7e 100644 --- a/fs/nfsd/nfsproc.c +++ b/fs/nfsd/nfsproc.c @@ -204,7 +204,6 @@ nfsd_proc_write(struct svc_rqst *rqstp, struct nfsd_writeargs *argp, struct nfsd_attrstat *resp) { __be32 nfserr; - int stable = 1; unsigned long cnt = argp->len; dprintk("nfsd: WRITE %s %d bytes at %d\n", @@ -215,7 +214,7 @@ nfsd_proc_write(struct svc_rqst *rqstp, struct nfsd_writeargs *argp, argp->offset, rqstp->rq_vec, argp->vlen, &cnt, - &stable); + NFS_DATA_SYNC); return nfsd_return_attrs(nfserr, resp); } diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 26c6fdb..726b2d2 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -940,14 +940,13 @@ static int wait_for_concurrent_writes(struct file *file) __be32 nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, loff_t offset, struct kvec *vec, int vlen, - unsigned long *cnt, int *stablep) + unsigned long *cnt, int stable) { struct svc_export *exp; struct inode *inode; mm_segment_t oldfs; __be32 err = 0; int host_err; - int stable = *stablep; int use_wgather; loff_t pos = offset; unsigned int pflags = current->flags; @@ -968,7 +967,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, use_wgather = (rqstp->rq_vers == 2) && EX_WGATHER(exp); if (!EX_ISSYNC(exp)) - stable = 0; + stable = NFS_UNSTABLE; if (stable && !use_wgather) flags |= RWF_SYNC; @@ -1037,7 +1036,7 @@ __be32 nfsd_read(struct svc_rqst *rqstp, struct svc_fh *fhp, __be32 nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, loff_t offset, struct kvec *vec, int vlen, unsigned long *cnt, - int *stablep) + int stable) { __be32 err = 0; @@ -1050,7 +1049,7 @@ nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, goto out; trace_write_opened(rqstp, fhp, offset, vlen); err = nfsd_vfs_write(rqstp, fhp, file, offset, vec, vlen, cnt, - stablep); + stable); trace_write_io_done(rqstp, fhp, offset, vlen); } else { err = nfsd_open(rqstp, fhp, S_IFREG, NFSD_MAY_WRITE, &file); @@ -1060,7 +1059,7 @@ nfsd_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, trace_write_opened(rqstp, fhp, offset, vlen); if (cnt) err = nfsd_vfs_write(rqstp, fhp, file, offset, vec, vlen, - cnt, stablep); + cnt, stable); trace_write_io_done(rqstp, fhp, offset, vlen); fput(file); } diff --git a/fs/nfsd/vfs.h b/fs/nfsd/vfs.h index 0bf9e7b..8458d8c 100644 --- a/fs/nfsd/vfs.h +++ b/fs/nfsd/vfs.h @@ -84,11 +84,11 @@ __be32 nfsd_readv(struct file *, loff_t, struct kvec *, int, __be32 nfsd_read(struct svc_rqst *, struct svc_fh *, loff_t, struct kvec *, int, unsigned long *); __be32 nfsd_write(struct svc_rqst *, struct svc_fh *,struct file *, - loff_t, struct kvec *,int, unsigned long *, int *); + 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 kvec *vec, int vlen, unsigned long *cnt, - int *stablep); + int stable); __be32 nfsd_readlink(struct svc_rqst *, struct svc_fh *, char *, int *); __be32 nfsd_symlink(struct svc_rqst *, struct svc_fh *,