From patchwork Thu Mar 19 11:04:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kinglong Mee X-Patchwork-Id: 6048341 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 6AF2A9F399 for ; Thu, 19 Mar 2015 11:04:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A09172051D for ; Thu, 19 Mar 2015 11:04:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C5262204EC for ; Thu, 19 Mar 2015 11:04:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753083AbbCSLEZ (ORCPT ); Thu, 19 Mar 2015 07:04:25 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:36290 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751799AbbCSLEZ (ORCPT ); Thu, 19 Mar 2015 07:04:25 -0400 Received: by padcy3 with SMTP id cy3so72532370pad.3 for ; Thu, 19 Mar 2015 04:04:24 -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=P8AknpJRDHKMf5zWAO4OUDH27L2h/qVTAVkt/OCAIXY=; b=LlVrHWw2zha9SkFGAMNSd0381V9jrWEJir+6wq30JVm+3+ygmBWYFsK91frXgeu1ly OwRSSJBB310eJTFDXvgpIcZkNlYnyM4eJiMTwleXCd47uAh96euJ4dGtF9oEUCIOCuIV ByIG6bnOFiSD9DzuXl6wKQ1gjlUQxpfHHmlGE7xtiS3XvsONkvItzz//x8kO04HlkkMi yPS4+LmM3Q2RVblkJIv2Sx9LCIKiPEQi40KUfDWY/JPO7cD/XIBvBF7m2PLRSrWH9Sx5 RAZlqpreoJz93KSRXSEwie0eNDJK+kE077319AGoz+0OqnU3wkHAhO87Bca3ldsAEXsn zphg== X-Received: by 10.66.149.106 with SMTP id tz10mr174928576pab.90.1426763064513; Thu, 19 Mar 2015 04:04:24 -0700 (PDT) Received: from [192.168.99.4] ([104.143.41.80]) by mx.google.com with ESMTPSA id se2sm2421980pac.38.2015.03.19.04.04.20 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Mar 2015 04:04:23 -0700 (PDT) Message-ID: <550AAD2E.6040607@gmail.com> Date: Thu, 19 Mar 2015 19:04:14 +0800 From: Kinglong Mee User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: "J. Bruce Fields" CC: Linux NFS Mailing List , Christoph Hellwig Subject: [PATCH] NFSD: Check layout type when returning client layouts 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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 According to RFC5661: " When lr_returntype is LAYOUTRETURN4_FSID, the current filehandle is used to identify the file system and all layouts matching the client ID, the fsid of the file system, lora_layout_type, and lora_iomode are returned. When lr_returntype is LAYOUTRETURN4_ALL, all layouts matching the client ID, lora_layout_type, and lora_iomode are returned and the current filehandle is not used. " When returning client layouts, always check layout type. Signed-off-by: Kinglong Mee Reviewed-by: Christoph Hellwig --- fs/nfsd/nfs4layouts.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/nfsd/nfs4layouts.c b/fs/nfsd/nfs4layouts.c index 3c1bfa1..44341d6 100644 --- a/fs/nfsd/nfs4layouts.c +++ b/fs/nfsd/nfs4layouts.c @@ -513,6 +513,9 @@ nfsd4_return_client_layouts(struct svc_rqst *rqstp, spin_lock(&clp->cl_lock); list_for_each_entry_safe(ls, n, &clp->cl_lo_states, ls_perclnt) { + if (ls->ls_layout_type != lrp->lr_layout_type) + continue; + if (lrp->lr_return_type == RETURN_FSID && !fh_fsid_match(&ls->ls_stid.sc_file->fi_fhandle, &cstate->current_fh.fh_handle))