Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7042637ybi; Mon, 22 Jul 2019 06:12:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqxEbDf4uwXcFJlt6/juJRYAeDjHhI69u4mYX5d4hzgmi2Wykl31k8mC6JdCcVbpphZM3B+E X-Received: by 2002:a17:90a:ba93:: with SMTP id t19mr76035207pjr.139.1563801125907; Mon, 22 Jul 2019 06:12:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563801125; cv=none; d=google.com; s=arc-20160816; b=abeI6bgO1t20TCusMh3UvitSksdyKcPXITB3zFz77eZ/CeGntRrGIzPHqul9OI+5mo CJD8pMGw3yhUf9qVSk2tPzkQw/h3ojiKJQ+24c1syQdDCwn1plCrkisAHWj+/Mby5hFT 2OoLR8FOd77UrMYrSTdR33ykU65odL1RlEJ/AFVh6S+GiRVEDVFFFSogH+EUjy7WOS+j bYycAFktnAusS9P4HI4lhPuYM4mht4RUXTU6m7bCiwNQH2aQWP7W2oxECBAQqEb/X6T3 DPeVusT/zjVfZqHLHJf8CN2+JSM6vZqnZ3+3jJRZNS+75nIHgwM47aj/DFR2jzAISRIW hRCA== 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=JKc1LD4jSCqWHmd0JkR0FlX8K8RqLm2C4D+xKCJ6XrY=; b=yuX/8N0B9pyx1PFbhiN2w4+KPvdP+BzYWncavOgjPF+JOBZhkSj+vIjysgo6epwEJQ Mp716XCXctAFjf6k1O55TuQ+7w0oD2p47MxI+A3aA6WyZkto5AUbvY4rLCM4x7ahlMGC WrW0PPLHE6htbH7tK3ZZy1v48S4B6orLkNlN9I/yjdTN5RHG9eIVsdpTqu37XE4ilirB Vs8R2luGzCV/WRYM6dzcKTQ6h+CBpLvvoEXyhp/WJM8ATI+Muoh70YAqTryePpde23IQ i5OhhoOrnZPWGfrqLLi0SWF6EffyzIYFumqA2JOSNOMlLHBP1mHleHJkbStsJ+9SNweG QDWw== 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 w2si7672478plq.414.2019.07.22.06.11.52; Mon, 22 Jul 2019 06:12:05 -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 S1728094AbfGVMmX (ORCPT + 99 others); Mon, 22 Jul 2019 08:42:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40912 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727123AbfGVMmX (ORCPT ); Mon, 22 Jul 2019 08:42:23 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 73D8246673 for ; Mon, 22 Jul 2019 12:42:22 +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 156B361352; Mon, 22 Jul 2019 12:42:22 +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: Date: Mon, 22 Jul 2019 08:42:21 -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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 22 Jul 2019 12:42:22 +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!"); >