From patchwork Fri Jan 26 17:24:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olga Kornievskaia X-Patchwork-Id: 10186677 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 EEC2E602C8 for ; Fri, 26 Jan 2018 17:24:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DFCC92A154 for ; Fri, 26 Jan 2018 17:24:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D2D972A159; Fri, 26 Jan 2018 17:24:36 +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_SIGNED, 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 E25012A154 for ; Fri, 26 Jan 2018 17:24:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751409AbeAZRYe (ORCPT ); Fri, 26 Jan 2018 12:24:34 -0500 Received: from mail-ua0-f195.google.com ([209.85.217.195]:43159 "EHLO mail-ua0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751377AbeAZRYd (ORCPT ); Fri, 26 Jan 2018 12:24:33 -0500 Received: by mail-ua0-f195.google.com with SMTP id i5so749080uai.10 for ; Fri, 26 Jan 2018 09:24:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:from:date:message-id:subject:to:cc; bh=k/2vGgA7rx+yPRykYMosqWeF/IJ2ggKMEALbbx4KaQY=; b=emYP+xp7aItjRaNNtwz4iV5J4659e0uxY/xAYC+CezwjkSM/DfVifpRCXqzSmyQDZz 9IPMOQVLY4ybvzDqdCFo2w+p+M12PUjHIDtKhdUKpQZZwnONqIM3rOafbuvzmwQcUXb2 VvzL4cLmG4cEFHSqMaQOQUHlvmP0ekjrtcaDNIIOnbpE+DamHaQSAiz9kJSk6XbLMK41 fdvINaOOIYn9E6ASPHM4nYF98yJbs0pZ1yWeGf6xGxK4tMgmK/AWcEVFIqZ7euJ6FWY8 cVoHcm1YGF4Q8qGaQVOqW7T8n1pyC5CPMJT0/e5SX7dA6+97e3S9tt5J7huYdaEvFrpg kmXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:from:date:message-id:subject :to:cc; bh=k/2vGgA7rx+yPRykYMosqWeF/IJ2ggKMEALbbx4KaQY=; b=GUS8ole7iqAy5eWworuqual+g7xhzOUL46Yi2Mm8WJD/i/Cu29295INC53bloOBtjJ CRd2fhCmShssegljS1uj9OB0il+vDwT2selGTKSgyGVK9MLbWpgpk1WiEcYX4Z0J7mDH KxOPhnxaZviJPy7/ooKuLwQNTYBxeD4YsAjBEtP+ogMzUSLnyceTyGA47SZcNL2OZuJr M7rKaOdiejQ3TQryAjZsi7Qa098AokcOfIyH25VQhI3UktTKjuCGtbiQqEDOz3Ky+hLO AUjYxNB+VhNgD4ZiPKkHW7UEBAwYL9YiiQDwyEFW0kNpamMqDvHC7fEk9pxPbWVfioYz cncQ== X-Gm-Message-State: AKwxytf+XOqQOyQsh01/60mLch0sVEs1CG0rcb9a0oScNeRXsCUdx551 EofnekldjTmt5skOG4a4a+7eCU5+7ixHZCKWyT0= X-Google-Smtp-Source: AH8x224e9sBmwhS0xlGKUYQxkVN8UdolFNCA53MEHcvqqpMbjqQzOXQxdiqAr+3dVRZaCmhoQtbook/36r0ZyrVwFQw= X-Received: by 10.159.49.239 with SMTP id w44mr7595621uad.111.1516987472525; Fri, 26 Jan 2018 09:24:32 -0800 (PST) MIME-Version: 1.0 Received: by 10.103.91.71 with HTTP; Fri, 26 Jan 2018 09:24:31 -0800 (PST) From: Olga Kornievskaia Date: Fri, 26 Jan 2018 12:24:31 -0500 X-Google-Sender-Auth: vdvEoAH9oQloQ1HlVBrj_zbBT2Q Message-ID: Subject: problem on nfsd doing RDMA write To: Chuck Lever , "J. Bruce Fields" Cc: linux-nfs 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 Hi Bruce/Chuck, There is a problem with nfsd doing a WRITE of size 4093,4094,4095. To reproduce, mount with RDMA and do a simple dd "dd if=/dev/zero of=/mnt/testfile bs=4093 count=1". What happens is that nfsd fails to parse GETATTR after the WRITE in the compound. It fails the operation with ERR_OP_ILLEGAL. The problem happens for the values where XDR round up ends up rounding up to the page size. I don't know if my fix is the appropriate way to fix this but with it I don't get the error: So the problem is the using "len" instead of "write->wr_buflen" leads for the values 4093,4094,4095 that are rounded up to 4096, it makes pages=1 and the argp->pagelen ends up being a negative value leading to problems of parsing the GETATTR. If this looks OK, I can send a patch. --- 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/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 2c61c6b..a8489c3 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -1289,11 +1289,12 @@ static __be32 nfsd4_decode_opaque(struct nfsd4_compounda len = XDR_QUADLEN(write->wr_buflen) << 2; if (len >= avail) { - int pages; + int pages = 0; len -= avail; - pages = len >> PAGE_SHIFT; + if (write->wr_buflen >= PAGE_SIZE) + pages = len >> PAGE_SHIFT; argp->pagelist += pages; argp->pagelen -= pages * PAGE_SIZE; len -= pages * PAGE_SIZE;