From patchwork Mon Jun 13 01:27:19 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sid Moore X-Patchwork-Id: 873762 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p5D1ROD2024565 for ; Mon, 13 Jun 2011 01:27:24 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754543Ab1FMB1V (ORCPT ); Sun, 12 Jun 2011 21:27:21 -0400 Received: from mail-gx0-f174.google.com ([209.85.161.174]:35848 "EHLO mail-gx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754542Ab1FMB1V convert rfc822-to-8bit (ORCPT ); Sun, 12 Jun 2011 21:27:21 -0400 Received: by gxk21 with SMTP id 21so2673924gxk.19 for ; Sun, 12 Jun 2011 18:27:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=d4uK6wfJ63qdlVwTuLt45Jh0j5tSrrB5GlVyBEJ531Q=; b=UvQcxRyXpm8Z6UkFtEuC9XAX0LHKAyU4162NnTErhcoxeKMFeASjcOkVKcOufom62j tv+q5lniCkorswkvaLUDR7YDSyYLq0ZW9ZV/9SK5OyGlyX39AL4zwM57eMcRw2zYtAn/ OdTGd41ojuSzyyHgR7cXrDJkdgIBTGlELAT8c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=RTeGangSQKLdlLsnzyFuVnH9/fBF7T9+SitYpipxBQZK4JpV7/+fObCNPIWYfipfav NH18D+Tc4gyj6FOLDmyX4Im5R+ZsOXsGa+GlYbSH4jXNhwanYgz4OLAeuzm6Un3YSMQz 3jRwUWnsmSK/ie/Rswq40gjb1nC2G3yQ3cFA0= MIME-Version: 1.0 Received: by 10.236.189.66 with SMTP id b42mr5929299yhn.520.1307928439771; Sun, 12 Jun 2011 18:27:19 -0700 (PDT) Received: by 10.236.139.162 with HTTP; Sun, 12 Jun 2011 18:27:19 -0700 (PDT) Date: Mon, 13 Jun 2011 09:27:19 +0800 Message-ID: Subject: [Patch 1/1]: fixed a bug that EXCHGID4_FLAG_CONFIRMED_R is cleared in EXCHANGE_ID reply if incarnation is a confirmed client From: Sid Moore To: "J. Bruce Fields" Cc: linux-nfs@vger.kernel.org Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 13 Jun 2011 01:27:24 +0000 (UTC) On Sun, Jun 12, 2011 at 7:59 AM, J. Bruce Fields wrote: > On Sat, Jun 11, 2011 at 03:54:56PM +0800, Sid Moore wrote: >> Hi >> >> on Linux NFSv4.1 server, nfsd4_exchange_id() is used for creating a >> new client incarnation or updating a confirmed client incarnation. if >> try to update a confirmed incarnation, EXCHGID4_FLAG_CONFIRMED_R >> should be set in eir_flags according to section 18.35.3, RFC5661. >> >> but I found EXCHGID4_FLAG_CONFIRMED_R is cleared by "clid->flags = >> new->cl_exchange_flags;", which is in nfsd4_set_ex_flags() called by >> nfsd4_exchange_id(). >> >> so the sematics of RFC5661 is broken? am I correct? > > On a quick glance.... I think you're correct.  Patch welcomed. > > --b. > Hi, Bruce I think the patch below might be able to fix this issue. I am not sure what impact would be produced if EXCHGID4_FLAG_CONFIRMED_R directly set on confirmed clients. So, I take a conservative way. Please review it. Thanks. --- Sid -- 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/nfs4state.c b/fs/nfsd/nfs4state.c index 6fb7283..4bd9281 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -1394,6 +1394,7 @@ nfsd4_exchange_id(struct svc_rqst *rqstp, char addr_str[INET6_ADDRSTRLEN]; nfs4_verifier verf = exid->verifier; struct sockaddr *sa = svc_addr(rqstp); + int confirmed_clnt = 0; rpc_ntop(sa, addr_str, sizeof(addr_str)); dprintk("%s rqstp=%p exid=%p clname.len=%u clname.data=%p " @@ -1455,7 +1456,7 @@ nfsd4_exchange_id(struct svc_rqst *rqstp, * Set bit when the owner id and verifier map to an already * confirmed client id (18.35.3). */ - exid->flags |= EXCHGID4_FLAG_CONFIRMED_R; + confirmed_clnt = 1; /* * Falling into 18.35.4 case 2, possible router replay. @@ -1498,6 +1499,9 @@ out_copy: exid->seqid = 1; nfsd4_set_ex_flags(new, exid); + if (confirmed_clnt) + exid->flags |= EXCHGID4_FLAG_CONFIRMED_R; + dprintk("nfsd4_exchange_id seqid %d flags %x\n", new->cl_cs_slot.sl_seqid, new->cl_exchange_flags);