From patchwork Tue Apr 21 22:36:41 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 6254131 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5BECF9F1C4 for ; Tue, 21 Apr 2015 22:36:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 973B72034F for ; Tue, 21 Apr 2015 22:36:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 563EA20340 for ; Tue, 21 Apr 2015 22:36:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753428AbbDUWgm (ORCPT ); Tue, 21 Apr 2015 18:36:42 -0400 Received: from mail-ig0-f174.google.com ([209.85.213.174]:35522 "EHLO mail-ig0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753466AbbDUWgl (ORCPT ); Tue, 21 Apr 2015 18:36:41 -0400 Received: by igbyr2 with SMTP id yr2so99670651igb.0 for ; Tue, 21 Apr 2015 15:36:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:cc:content-type; bh=aqcNUiM4aJEbugO+aMiTaRgih1RM9tBVBaJ0+ryHOPs=; b=JnF+9GCQE5F91bU6lCjms+DlX9DAMyTs6ojMo3ge+ThKbX7AilziNaoZtr22ZYp4tR EPJWcV966Z3NnPUTt4HFJjEtShKwPYbU5tT9tokz9OnxbcllnI0gf6LMf7ByZdJUCYXs Abk3bEpD6pGfSkppUZU/aMFYOqolilW76VLYuGRSAAaIxZlXMTrw11USEgdhiD6Ww3wf zhjSBdzM89TgeBBGa6vfRhWhiWJMG1+OmDVnAPi8ResOivJXne4D+xzCzeSa+9y1QT2m 4our37Wqbt8ReJ4PnWo8dR4c0m/91ZzGrjKeRnbfWpU3lTKrTOH/Xxaz00VdcF1HBmeq 05Gw== MIME-Version: 1.0 X-Received: by 10.50.102.68 with SMTP id fm4mr365060igb.25.1429655801257; Tue, 21 Apr 2015 15:36:41 -0700 (PDT) Received: by 10.107.131.214 with HTTP; Tue, 21 Apr 2015 15:36:41 -0700 (PDT) Date: Tue, 21 Apr 2015 18:36:41 -0400 X-Google-Sender-Auth: k4v_rUqdojX40nTlAcJqE6zhIkQ Message-ID: Subject: [PATCH 1/1] Recover from stateid-type error on SETATTR From: Olga Kornievskaia To: Trond Myklebust , Anna Schumaker Cc: linux-nfs Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Client can receives stateid-type error (eg., BAD_STATEID) on SETATTR when delegation stateid was used. When no open state exists, in case of application calling truncate() on the file, client has no state to recover and fails with EIO. Instead, upon such error, return the bad delegation and then resend the SETATTR with a zero stateid. In general, when something calls nfs4_handle_exception() with a null state, the operation should be retried after bad delegation is removed. Signed-off: Olga Kornievskaia --- fs/nfs/nfs4proc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) break; -- -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index ad7cf7e..fbde292 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -360,8 +360,11 @@ static int nfs4_handle_exception(struct nfs_server *server, int errorcode, struc case -NFS4ERR_DELEG_REVOKED: case -NFS4ERR_ADMIN_REVOKED: case -NFS4ERR_BAD_STATEID: - if (state == NULL) + if (state == NULL) { + nfs4_inode_return_delegation(inode); + exception->retry = 1; break; + } ret = nfs4_schedule_stateid_recovery(server, state); if (ret < 0)