From patchwork Wed Jan 23 23:24:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J. Bruce Fields" X-Patchwork-Id: 2027201 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id A5BB5E00CF for ; Wed, 23 Jan 2013 23:25:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752008Ab3AWXZA (ORCPT ); Wed, 23 Jan 2013 18:25:00 -0500 Received: from fieldses.org ([174.143.236.118]:54693 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751143Ab3AWXZA (ORCPT ); Wed, 23 Jan 2013 18:25:00 -0500 Received: from bfields by fieldses.org with local (Exim 4.76) (envelope-from ) id 1Ty9gh-0001uI-2O; Wed, 23 Jan 2013 18:24:59 -0500 Date: Wed, 23 Jan 2013 18:24:58 -0500 From: "bfields@fieldses.org" To: fanchaoting Cc: "linux-nfs@vger.kernel.org" Subject: Re: [PATCH] nfsd: Check the nfsd support version when enable or disable the minorversion Message-ID: <20130123232458.GB6565@fieldses.org> References: <50FFB43A.8030105@cn.fujitsu.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <50FFB43A.8030105@cn.fujitsu.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Wed, Jan 23, 2013 at 05:58:18PM +0800, fanchaoting wrote: > when enable or disable the minorversion throw /proc/fs/nfsd/versions,it > should check the support version. > > for example > if we do like following: > > echo "+2 +3 +4 +7.1">/proc/fs/nfsd/versions > echo "+2 +3 +4 -7.1">/proc/fs/nfsd/versions > it will enable or disable nfs4.1, but now the number nfs7 didn't support. Actually, who knows whether a hypothetical NFSv7 would even support minor versioning. Let's just do this: --b. > > Signed-off-by: Fan Chaoting > > --- > fs/nfsd/nfsctl.c | 2 +- > fs/nfsd/nfsd.h | 1 + > fs/nfsd/nfssvc.c | 4 ++++ > 3 files changed, 6 insertions(+), 1 deletion(-) > > diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c > index dab350d..1a6e89c 100644 > --- a/fs/nfsd/nfsctl.c > +++ b/fs/nfsd/nfsctl.c > @@ -532,7 +532,7 @@ static ssize_t __write_versions(struct file *file, char *buf, size_t size) > else > num = simple_strtol(vers, &minorp, 0); > if (*minorp == '.') { > - if (num < 4) > + if (num < 4 || num >= nfsd_number_vers()) > return -EINVAL; > minor = simple_strtoul(minorp+1, NULL, 0); > if (minor == 0) > diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h > index 80d5ce4..c9d7203 100644 > --- a/fs/nfsd/nfsd.h > +++ b/fs/nfsd/nfsd.h > @@ -104,6 +104,7 @@ int nfsd_vers(int vers, enum vers_op change); > int nfsd_minorversion(u32 minorversion, enum vers_op change); > void nfsd_reset_versions(void); > int nfsd_create_serv(void); > +int nfsd_number_vers(void); > > extern int nfsd_max_blksize; > > diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c > index 2013aa00..072cdb9 100644 > --- a/fs/nfsd/nfssvc.c > +++ b/fs/nfsd/nfssvc.c > @@ -670,3 +670,7 @@ int nfsd_pool_stats_release(struct inode *inode, struct file *file) > mutex_unlock(&nfsd_mutex); > return ret; > } > + > +int nfsd_number_vers(void) { > + return NFSD_NRVERS; > +} > -- > 1.7.10.1 > --- 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/nfsctl.c b/fs/nfsd/nfsctl.c index 7493428..65889ec 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c @@ -534,7 +534,7 @@ static ssize_t __write_versions(struct file *file, char *buf, size_t size) else num = simple_strtol(vers, &minorp, 0); if (*minorp == '.') { - if (num < 4) + if (num != 4) return -EINVAL; minor = simple_strtoul(minorp+1, NULL, 0); if (minor == 0)