From patchwork Fri Jun 13 09:32:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kinglong Mee X-Patchwork-Id: 4347861 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2A143BEEAA for ; Fri, 13 Jun 2014 09:33:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4C4CB201CD for ; Fri, 13 Jun 2014 09:33:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AE89B2028D for ; Fri, 13 Jun 2014 09:33:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752388AbaFMJdQ (ORCPT ); Fri, 13 Jun 2014 05:33:16 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:37886 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752296AbaFMJdQ (ORCPT ); Fri, 13 Jun 2014 05:33:16 -0400 Received: by mail-pb0-f46.google.com with SMTP id md12so1163257pbc.19 for ; Fri, 13 Jun 2014 02:33:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; bh=t5XJApyfWQ4ud/UVzkvO3y5+Mhan7Csnen2ignyctQM=; b=SdqD6hIWxGNvCVj5DAP93bgrrapPHSDSnr4an/I3jNoalsQrmCl67UZv6gXuGa9ha1 reVnfp6m1Qs5ux3U3ZffxuUX0f+S3tynrsI+bNFDyxtWuVj8BTpFOdEsIKTZqpzOdrHk s9qpZ0E8+KDPLV4bzlLk1ZwP/cTw6sTAsYwogOVrrPJ4qstX8Ekhe4aQLAaPQ85qIhv+ o7FgWjMiVu3IBIxX20IQhhaTfREuS42Lz+9wM9wDYYbOp/ZB6JBzla3cHQ+ofEDCGCNi eo9j39S76Uq1ceCCbwGbfSY7vtx1PdBlG6h+ERLoGhx4mIy8Lz6Dgohp2iurNMxQ/Ef1 ZF6A== X-Received: by 10.68.196.202 with SMTP id io10mr1653525pbc.149.1402651995490; Fri, 13 Jun 2014 02:33:15 -0700 (PDT) Received: from [192.168.0.100] ([171.92.21.4]) by mx.google.com with ESMTPSA id ja8sm2564851pbd.3.2014.06.13.02.33.11 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 13 Jun 2014 02:33:14 -0700 (PDT) Message-ID: <539AC53A.9070600@gmail.com> Date: Fri, 13 Jun 2014 17:32:42 +0800 From: Kinglong Mee User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: "J. Bruce Fields" CC: Linux NFS Mailing List , kinglongmee@gmail.com Subject: [PATCH] NFSD: fix bug for readdir of pseudofs Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 Commit 561f0ed498ca (nfsd4: allow large readdirs) introduces a bug about readdir the root of pseudofs. Call xdr_truncate_encode() revert encoded name when skipping. Signed-off-by: Kinglong Mee --- fs/nfsd/nfs4xdr.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 53ca43c..30913c8 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -2687,6 +2687,7 @@ nfsd4_encode_dirent(void *ccdv, const char *name, int namlen, nfserr = nfserr_toosmall; goto fail; case nfserr_noent: + xdr_truncate_encode(xdr, start_offset); goto skip_entry; default: /*