Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7041372ybi; Mon, 22 Jul 2019 06:11:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqwHw9q6BYMn1a2Z7f9LGolSoILPPo5jMY0LH3/T3/3EVgUtTX0gpWo5YnUKkEm4mD7KQvvk X-Received: by 2002:a17:902:4283:: with SMTP id h3mr73348532pld.15.1563801064419; Mon, 22 Jul 2019 06:11:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563801064; cv=none; d=google.com; s=arc-20160816; b=sGxgcdExTlrOelPn4d0+/1Wj8YEP3pqnu7maUAS+hO9G9e8ryMo3A4iFC5eIYPOuKr 1eR5SDZ6LlZaCic7cmeSRa25jB70Si9YC7r6ZWC49Hub/eNdK/a0+gOyON7Gj64tS2CL wVHPNEQD9aOajgxY7GcjNi7S2s6rafAb3jTSOjTDhhpbETgw6rr2cK11cAPUSfWhOXWz 9bSi7kJh7HwbZ5uAmf/QzwSwtFeP0TANswzWQ425STdOU9LFbLD1xuki9RDtqhGdkw1t eS6B8UkhoGyhyBxEVAJ3PvK0G8dzkoMvX72oP3lsbJ2u8XgWypetVAdHTWYazeqtlfbp u+yA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=z124RHQkuNShnaM16/4XI4MLFhmsWBnzpwWpgv18rz4=; b=pKgfaUNw6ErM/k9j/BGFb960QGSgtknkNBGIafCfmOs2KYtsuTZQ3fNNCycOWU9AaU j2FzFoCZhL6GM4Rdm0GVV8e+TwcpzBLp+wGP2fxEfhh+t7pdXXhn3c0cr0cRO1baEAdF wY1/KCDLFDWTolwUOd8N6+JFuONF30Hsieh0J7Ixyl49zgGtqnTLDXo2eUwzr2Wh3JH7 sJfW+Mqaf9BA6wxOndDamAUbD8EBWct8xIuROddiQrhsVJsRSJjQnEXfn9q0kS6+30lI j2r7ZeVsX0HhXJQnmPGQqTt0Q7WLRpADKhL5dX4k6Tgf0kkxdNtcFQ/v2xTAIm5QksqZ tx5w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bh4si9734467plb.198.2019.07.22.06.10.39; Mon, 22 Jul 2019 06:11:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727304AbfGVMmE (ORCPT + 99 others); Mon, 22 Jul 2019 08:42:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52048 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727123AbfGVMmE (ORCPT ); Mon, 22 Jul 2019 08:42:04 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BA82385541 for ; Mon, 22 Jul 2019 12:42:03 +0000 (UTC) Received: from madhat.boston.devel.redhat.com (ovpn-116-68.phx2.redhat.com [10.3.116.68]) by smtp.corp.redhat.com (Postfix) with ESMTP id 58BB060BF1; Mon, 22 Jul 2019 12:42:03 +0000 (UTC) Subject: Re: [nfs-utils PATCH 1/2] sqlite.c: restore zero-padding to the recovery table names To: Scott Mayhew Cc: linux-nfs@vger.kernel.org References: <20190626190432.16257-1-smayhew@redhat.com> From: Steve Dickson Message-ID: <064ffcca-1fb3-ff5a-181c-ba7846b89b54@RedHat.com> Date: Mon, 22 Jul 2019 08:42:02 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190626190432.16257-1-smayhew@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 22 Jul 2019 12:42:03 +0000 (UTC) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On 6/26/19 3:04 PM, Scott Mayhew wrote: > Commit a8133e1fd1742 removed the zero-padding from the table names and > broke grace period handling. Running nfsdcld with verbose logging shows > messages similar to the following: > > nfsdcld: cld_gracestart: sending client records to the kernel > nfsdcld: sqlite_iterate_recovery: select statement prepare failed: no such table: rec-1b > nfsdcld: Doing downcall with status -121 > nfsdcld: cld_inotify_cb: called for EV_READ > nfsdcld: cld_pipe_open: opening upcall pipe /var/lib/nfs/rpc_pipefs/nfsd/cld > nfsdcld: cld_gracedone: grace done. > nfsdcld: Unable to drop table for recovery epoch: no such table: rec-1b > nfsdcld: Doing downcall with status -121 > > Fixes: a8133e1fd1742 ("sqlite.c: Use PRIx64 macro to print 64-bit integers") > > Signed-off-by: Scott Mayhew Committed... steved. > --- > utils/nfsdcld/sqlite.c | 18 +++++++++--------- > 1 file changed, 9 insertions(+), 9 deletions(-) > > diff --git a/utils/nfsdcld/sqlite.c b/utils/nfsdcld/sqlite.c > index cd658ef..5d78d24 100644 > --- a/utils/nfsdcld/sqlite.c > +++ b/utils/nfsdcld/sqlite.c > @@ -536,7 +536,7 @@ sqlite_copy_cltrack_records(int *num_rec) > xlog(L_ERROR, "Unable to begin transaction: %s", err); > goto rollback; > } > - ret = snprintf(buf, sizeof(buf), "DELETE FROM \"rec-%" PRIx64 "\";", > + ret = snprintf(buf, sizeof(buf), "DELETE FROM \"rec-%016" PRIx64 "\";", > current_epoch); > if (ret < 0) { > xlog(L_ERROR, "sprintf failed!"); > @@ -551,7 +551,7 @@ sqlite_copy_cltrack_records(int *num_rec) > xlog(L_ERROR, "Unable to clear records from current epoch: %s", err); > goto rollback; > } > - ret = snprintf(buf, sizeof(buf), "INSERT INTO \"rec-%" PRIx64 "\" " > + ret = snprintf(buf, sizeof(buf), "INSERT INTO \"rec-%016" PRIx64 "\" " > "SELECT id FROM attached.clients;", > current_epoch); > if (ret < 0) { > @@ -704,7 +704,7 @@ sqlite_insert_client(const unsigned char *clname, const size_t namelen) > int ret; > sqlite3_stmt *stmt = NULL; > > - ret = snprintf(buf, sizeof(buf), "INSERT OR REPLACE INTO \"rec-%" PRIx64 "\" " > + ret = snprintf(buf, sizeof(buf), "INSERT OR REPLACE INTO \"rec-%016" PRIx64 "\" " > "VALUES (?);", current_epoch); > if (ret < 0) { > xlog(L_ERROR, "sprintf failed!"); > @@ -749,7 +749,7 @@ sqlite_remove_client(const unsigned char *clname, const size_t namelen) > int ret; > sqlite3_stmt *stmt = NULL; > > - ret = snprintf(buf, sizeof(buf), "DELETE FROM \"rec-%" PRIx64 "\" " > + ret = snprintf(buf, sizeof(buf), "DELETE FROM \"rec-%016" PRIx64 "\" " > "WHERE id==?;", current_epoch); > if (ret < 0) { > xlog(L_ERROR, "sprintf failed!"); > @@ -799,7 +799,7 @@ sqlite_check_client(const unsigned char *clname, const size_t namelen) > int ret; > sqlite3_stmt *stmt = NULL; > > - ret = snprintf(buf, sizeof(buf), "SELECT count(*) FROM \"rec-%" PRIx64 "\" " > + ret = snprintf(buf, sizeof(buf), "SELECT count(*) FROM \"rec-%016" PRIx64 "\" " > "WHERE id==?;", recovery_epoch); > if (ret < 0) { > xlog(L_ERROR, "sprintf failed!"); > @@ -892,7 +892,7 @@ sqlite_grace_start(void) > goto rollback; > } > > - ret = snprintf(buf, sizeof(buf), "CREATE TABLE \"rec-%" PRIx64 "\" " > + ret = snprintf(buf, sizeof(buf), "CREATE TABLE \"rec-%016" PRIx64 "\" " > "(id BLOB PRIMARY KEY);", > tcur); > if (ret < 0) { > @@ -916,7 +916,7 @@ sqlite_grace_start(void) > * values in the grace table, just clear out the records for > * the current reboot epoch. > */ > - ret = snprintf(buf, sizeof(buf), "DELETE FROM \"rec-%" PRIx64 "\";", > + ret = snprintf(buf, sizeof(buf), "DELETE FROM \"rec-%016" PRIx64 "\";", > tcur); > if (ret < 0) { > xlog(L_ERROR, "sprintf failed!"); > @@ -977,7 +977,7 @@ sqlite_grace_done(void) > goto rollback; > } > > - ret = snprintf(buf, sizeof(buf), "DROP TABLE \"rec-%" PRIx64 "\";", > + ret = snprintf(buf, sizeof(buf), "DROP TABLE \"rec-%016" PRIx64 "\";", > recovery_epoch); > if (ret < 0) { > xlog(L_ERROR, "sprintf failed!"); > @@ -1028,7 +1028,7 @@ sqlite_iterate_recovery(int (*cb)(struct cld_client *clnt), struct cld_client *c > return -EINVAL; > } > > - ret = snprintf(buf, sizeof(buf), "SELECT * FROM \"rec-%" PRIx64 "\";", > + ret = snprintf(buf, sizeof(buf), "SELECT * FROM \"rec-%016" PRIx64 "\";", > recovery_epoch); > if (ret < 0) { > xlog(L_ERROR, "sprintf failed!"); >