Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp431889pxj; Tue, 18 May 2021 06:40:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpPnfK0OhVNRCg5c7GOaZ2Nq4Jazas3GezBOjlH6h32C0EOIcIly3R4tmB1QXEv1jQdC35 X-Received: by 2002:a05:6e02:df2:: with SMTP id m18mr4227845ilj.77.1621345223209; Tue, 18 May 2021 06:40:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621345223; cv=none; d=google.com; s=arc-20160816; b=qyIkB7yZ1JM6/lxIeuDTDKSTvuUSB2wgTT9pWePcEYNou6Do7x40wt/OZWzQYGGqe+ a+WKBi+xiaxucw40wVI2zxgF0fqbnVJHUBA28Q7s94U4c8rbQojXeJpJI45QODndl266 FiHys9mRlVB9stswd5VrORqmdnqFuTioPjXW303Nu4gMxzvhWK0fia6c/xEHkP2GDnMG uMgr4SknqtGQZJ5i+6zYPkDn2CC4bc5PUWsSe3uORZHQugTrkxyaMYzrc7fqKjxemH3X Xg+ngXcTvtzoGOEiOviJvfX+xrX0Nwf8EwnP+6rj5gv2zYZUl02ce2hU9RoM30R4ptES uFjg== 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=lEx8m+nr0EoPiHbY6hVhqrwWFN3kX0A9ag88hu0Ft9A=; b=K/CHldrx5Xesq0/9x196DPbFg5uvd9zcwsOMHlY+LB1H8DLcTwxuUHuVddAVio/SD2 4u9Kq1CqwZ/6rpbtC/l2jb2dyhkzRQoyheyEXyTntieXmKca5z6qUofubyVr8EwcVxaB ylFHY6bYtHxoEmyXuAL+nMO9w5Z41EHvD8PUdJWJ3limz4+ESefzvzkbqTlVa9BDASoX cn/akod1EHqS/z6Xi+Mgmuf9Arey6HLz+bfs2vAipWG05C7VuUZuOqGYhDQhIMvhluc+ qOzAHr44i0bI6wyMWMkZOQVoZ/E9d75MYWPj5V+cjATlydz6ZVif3sUZ71z5/zr71sDJ EEDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RMQv5EJL; 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 h127si18723346iof.102.2021.05.18.06.40.09; Tue, 18 May 2021 06:40:23 -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=RMQv5EJL; 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 S245567AbhEQPjN (ORCPT + 99 others); Mon, 17 May 2021 11:39:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:40184 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243633AbhEQPYB (ORCPT ); Mon, 17 May 2021 11:24:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id E795D61C82; Mon, 17 May 2021 14:35:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262129; bh=Q/N41Wu6G7f2vA/oK8HIXZBsFS051hfhmJgTIaQ9e7A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RMQv5EJLVR4aaKoHMLjoHBtLTqiEo4Og3vQy4kXJtVJru7q7DbMQjIe1svZ6VH8XJ pX/HFOjGGOjTCC1//cByX4InWtXJFIJ7lUDojbC+5kPTiNsGLee4Ov3U0PmvnBvvWD veNVhs6T19umXSb2UX0EIj6zit9A6B1nbZIr2VfU= 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.10 117/289] NFS: Fix attribute bitmask in _nfs42_proc_fallocate() Date: Mon, 17 May 2021 16:00:42 +0200 Message-Id: <20210517140309.104897332@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@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 4fc61e3d098d..52d8cc253a2b 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