Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3028348pxj; Mon, 17 May 2021 15:58:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQf+Lzqpb4AT7vWrcWZ8XnruzMN7MY01h2SpfM4ZE66W9Yj+GjVQSmRUp77iBTpaMuaimB X-Received: by 2002:a05:6602:1212:: with SMTP id y18mr1900661iot.189.1621292311754; Mon, 17 May 2021 15:58:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621292311; cv=none; d=google.com; s=arc-20160816; b=rvrfirgZI2xwnAAN8CclZxavE6IXbJj4/2VvK98xgUP9ZRiB1bgruMETLbGM8/zuaA sZcZbLHUGPU6+fBjt59cvhJcEWpEADlIeNKRF36qhGAdNZd0x/22LauvT9Qd33TBcY1H Anmy1/a1O0GJ2qg5BeEM2qXyVSSVadEbez34ijDa/GJnzOcWMm24Qdwfz8Y0upcOodFw V2GDlR4OR27IBFyleX+o6yCnxHse4NkaUuF+T49n7PpxA4RTq0sicHwbSMvIpydadsMx BIEkXTykKWbUcJ284l0+m7/tHqbvHK7hti57HSvpKpp+7HQnyFxEUXNrq+0PrYgyr3+h Q/bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=eOJNKk5rDfPvjqE41HToIBIbD2PI+SyU79G+czRf5Hw=; b=UjBdAN97IoalTWjS+bkSl9HSWG7OkPs4cT2V1oZcWtj3il89PopfI7EQAFPOgipD3M 1P66peErAjqTLawJCkkIC2r0IhGzsfVtF8NH/QPCtUb0B4TEj75keNHH9y27dutl9vZG HNEc0ZxRHJzp0NQmxv3XQ/TLh/5rHnNkcLGtbnFuX+nZpmvpciw0JuEGSGtuAUX08bBV pPjtCrD/5YBMQB0XJMMsB5zJI3ZDcDYshsc4+Qm+77+7MEtVi6dEex4bYMt3uOJe7RQe 7MnklcA+rnfn8pZjRNfZ5gA6AzdXJNQr5pyObhxDxIJ9CLu4XJgHhRK5YDysfStROIDE 9oKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UqqEi0th; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l10si22247183iow.11.2021.05.17.15.58.18; Mon, 17 May 2021 15:58:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UqqEi0th; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237652AbhEQOTI (ORCPT + 99 others); Mon, 17 May 2021 10:19:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:46734 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238877AbhEQOQr (ORCPT ); Mon, 17 May 2021 10:16:47 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A116C613F7; Mon, 17 May 2021 14:09:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621260590; bh=Ss6tYW1cQ4BCofukIwYfk/gPutWqspYzfUx15gh1km8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UqqEi0thmLe04G2lmouIJTNqGt4b6u5HdLoUMU5Bqh9Tr1VhOYYfuXg0vACJ28kjv NyDQaT3DZFZGGozhmxzMPTNv2iKkJJTiiCcYE3YIss8xVH7IkAXA7z+kr6ROzJO1CM k1lFThKQIe31nf2MSL9VulW9IJU1NO+JBuV7MiSM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust , Sasha Levin Subject: [PATCH 5.12 151/363] NFS: Fix attribute bitmask in _nfs42_proc_fallocate() Date: Mon, 17 May 2021 16:00:17 +0200 Message-Id: <20210517140307.711302783@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.508966430@linuxfoundation.org> References: <20210517140302.508966430@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Trond Myklebust [ Upstream commit e99812e1382f0bfb6149393262bc70645c9f537a ] We can't use nfs4_fattr_bitmap as a bitmask, because it hasn't been filtered to represent the attributes supported by the server. Instead, let's revert to using server->cache_consistency_bitmask after adding in the missing SPACE_USED attribute. Fixes: 913eca1aea87 ("NFS: Fallocate should use the nfs4_fattr_bitmap") Signed-off-by: Trond Myklebust Signed-off-by: Sasha Levin --- fs/nfs/nfs42proc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c index 094024b0aca1..597005bc8a05 100644 --- a/fs/nfs/nfs42proc.c +++ b/fs/nfs/nfs42proc.c @@ -46,11 +46,12 @@ static int _nfs42_proc_fallocate(struct rpc_message *msg, struct file *filep, { struct inode *inode = file_inode(filep); struct nfs_server *server = NFS_SERVER(inode); + u32 bitmask[3]; struct nfs42_falloc_args args = { .falloc_fh = NFS_FH(inode), .falloc_offset = offset, .falloc_length = len, - .falloc_bitmask = nfs4_fattr_bitmap, + .falloc_bitmask = bitmask, }; struct nfs42_falloc_res res = { .falloc_server = server, @@ -68,6 +69,10 @@ static int _nfs42_proc_fallocate(struct rpc_message *msg, struct file *filep, return status; } + memcpy(bitmask, server->cache_consistency_bitmask, sizeof(bitmask)); + if (server->attr_bitmask[1] & FATTR4_WORD1_SPACE_USED) + bitmask[1] |= FATTR4_WORD1_SPACE_USED; + res.falloc_fattr = nfs_alloc_fattr(); if (!res.falloc_fattr) return -ENOMEM; @@ -75,7 +80,8 @@ static int _nfs42_proc_fallocate(struct rpc_message *msg, struct file *filep, status = nfs4_call_sync(server->client, server, msg, &args.seq_args, &res.seq_res, 0); if (status == 0) - status = nfs_post_op_update_inode(inode, res.falloc_fattr); + status = nfs_post_op_update_inode_force_wcc(inode, + res.falloc_fattr); kfree(res.falloc_fattr); return status; -- 2.30.2