Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759724AbcCDJlS (ORCPT ); Fri, 4 Mar 2016 04:41:18 -0500 Received: from mx2.suse.de ([195.135.220.15]:59856 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758928AbcCDJDF (ORCPT ); Fri, 4 Mar 2016 04:03:05 -0500 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" From: Jiri Slaby To: stable@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Olga Kornievskaia , Trond Myklebust , Jiri Slaby Subject: [PATCH 3.12 038/116] Failing to send a CLOSE if file is opened WRONLY and server reboots on a 4.x mount Date: Fri, 4 Mar 2016 10:01:23 +0100 Message-Id: <4c7eb9bc24f5e3a7d6ba10a44c66bd739418307b.1457082108.git.jslaby@suse.cz> X-Mailer: git-send-email 2.7.2 In-Reply-To: References: In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1459 Lines: 45 From: Olga Kornievskaia 3.12-stable review patch. If anyone has any objections, please let me know. =============== commit a41cbe86df3afbc82311a1640e20858c0cd7e065 upstream. A test case is as the description says: open(foobar, O_WRONLY); sleep() --> reboot the server close(foobar) The bug is because in nfs4state.c in nfs4_reclaim_open_state() a few line before going to restart, there is clear_bit(NFS4CLNT_RECLAIM_NOGRACE, &state->flags). NFS4CLNT_RECLAIM_NOGRACE is a flag for the client states not open owner states. Value of NFS4CLNT_RECLAIM_NOGRACE is 4 which is the value of NFS_O_WRONLY_STATE in nfs4_state->flags. So clearing it wipes out state and when we go to close it, “call_close” doesn’t get set as state flag is not set and CLOSE doesn’t go on the wire. Signed-off-by: Olga Kornievskaia Signed-off-by: Trond Myklebust Signed-off-by: Jiri Slaby --- fs/nfs/nfs4state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 52c9b880697e..fbe7e2f90a3c 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c @@ -1436,7 +1436,7 @@ restart: spin_unlock(&state->state_lock); } nfs4_put_open_state(state); - clear_bit(NFS4CLNT_RECLAIM_NOGRACE, + clear_bit(NFS_STATE_RECLAIM_NOGRACE, &state->flags); spin_lock(&sp->so_lock); goto restart; -- 2.7.2