From patchwork Thu Sep 26 18:42:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benny Halevy X-Patchwork-Id: 2950411 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4CC00BFF0B for ; Thu, 26 Sep 2013 18:42:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0CB002017B for ; Thu, 26 Sep 2013 18:42:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0192420164 for ; Thu, 26 Sep 2013 18:42:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754086Ab3IZSmM (ORCPT ); Thu, 26 Sep 2013 14:42:12 -0400 Received: from mail-qe0-f54.google.com ([209.85.128.54]:55568 "EHLO mail-qe0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753553Ab3IZSmL (ORCPT ); Thu, 26 Sep 2013 14:42:11 -0400 Received: by mail-qe0-f54.google.com with SMTP id cy11so1119161qeb.13 for ; Thu, 26 Sep 2013 11:42:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=tSzpgQMsrRtl9+wE782gC8OZXUVPuh5YmtHZoIzy6WA=; b=mcuRB54DgcATIjQx1dN/k+Vv0+vgJ4pc6QzzHNkqQDFl/RPd+J1boijcuCue4qu6Kl 3P82xvNxkQjubi9/Ka+M1brbEDhiVZUkT3Mzy9fa3jeRTI77aopVud3wDDUotvmQxROJ u91PpUYh+fVapoCADF1kSxeWHa0BvQUpIKpZtlMaINXa/59t7BBuwe7sjlXo/WlWyShD QqgIfcCISMoNlHhGFOe17YHFolbVdM7AMJvBAJUgX4svkqMkmiriUFBV5NHskm5V6c0c TrDa0fwv0WsfqqDFvltzvBh3rdogKUOeJsGoaHrenDT2grS0dNkdF6KXqTDuUKIGDrd4 bhDQ== X-Received: by 10.224.75.68 with SMTP id x4mr8434718qaj.7.1380220931431; Thu, 26 Sep 2013 11:42:11 -0700 (PDT) Received: from bhalevy-lt.il.tonian.com.com (nat-pool-bos-u.redhat.com. [66.187.233.207]) by mx.google.com with ESMTPSA id f5sm5122564qev.8.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 26 Sep 2013 11:42:10 -0700 (PDT) From: Benny Halevy To: " J. Bruce Fields" Cc: linux-nfs@vger.kernel.org Subject: [PATCH RFC v0 34/49] pnfsd: new nfsd filesystem file: pnfs_dlm_device Date: Thu, 26 Sep 2013 14:42:09 -0400 Message-Id: <1380220929-14257-1-git-send-email-bhalevy@primarydata.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <52447EA0.7070004@primarydata.com> References: <52447EA0.7070004@primarydata.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-9.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 From: Andy Adamson Change nfsd filesystem name from pnfs_ds_list to pnfs_dlm_device write the per block device dlm data server cache Signed-off-by: Andy Adamson Signed-off-by: Benny Halevy Acked-by: Steven Whitehouse Signed-off-by: Benny Halevy --- fs/nfsd/nfsctl.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index b8bfa2e..7da8584 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c @@ -50,6 +50,9 @@ enum { NFSD_Gracetime, NFSD_RecoveryDir, #endif +#ifdef CONFIG_PNFSD + NFSD_pnfs_dlm_device, +#endif }; /* @@ -68,6 +71,9 @@ enum { static ssize_t write_gracetime(struct file *file, char *buf, size_t size); static ssize_t write_recoverydir(struct file *file, char *buf, size_t size); #endif +#ifdef CONFIG_PNFSD +static ssize_t write_pnfs_dlm_device(struct file *file, char *buf, size_t size); +#endif static ssize_t (*write_op[])(struct file *, char *, size_t) = { [NFSD_Fh] = write_filehandle, @@ -83,6 +89,9 @@ static ssize_t (*write_op[])(struct file *, char *, size_t) = { [NFSD_Gracetime] = write_gracetime, [NFSD_RecoveryDir] = write_recoverydir, #endif +#ifdef CONFIG_PNFSD + [NFSD_pnfs_dlm_device] = write_pnfs_dlm_device, +#endif }; static ssize_t nfsctl_transaction_write(struct file *file, const char __user *buf, size_t size, loff_t *pos) @@ -1037,6 +1046,66 @@ static ssize_t write_recoverydir(struct file *file, char *buf, size_t size) #endif +#ifdef CONFIG_PNFSD + +static ssize_t __write_pnfs_dlm_device(struct file *file, char *buf, + size_t size) +{ + char *mesg = buf; + char *pnfs_dlm_device; + int max_size = NFSD_PNFS_DLM_DEVICE_MAX; + int len, ret = 0; + + if (size > 0) { + ret = -EINVAL; + if (size > max_size || buf[size-1] != '\n') + return ret; + buf[size-1] = 0; + + pnfs_dlm_device = mesg; + len = qword_get(&mesg, pnfs_dlm_device, size); + if (len <= 0) + return ret; + + ret = nfsd4_set_pnfs_dlm_device(pnfs_dlm_device, len); + } + return ret <= 0 ? ret : strlen(buf); +} + +/** + * write_pnfs_dlm_device - Set or report the current pNFS data server list + * + * Input: + * buf: ignored + * size: zero + * + * OR + * + * Input: + * buf: C string containing a block device name, + * a colon, and then a comma separated + * list of pNFS data server IPv4 addresses + * size: non-zero length of C string in @buf + * Output: + * On success: passed-in buffer filled with '\n'-terminated C + * string containing a block device name, a colon, and + * then a comma separated list of pNFS + * data server IPv4 addresses. + * return code is the size in bytes of the string + * On error: return code is a negative errno value + */ +static ssize_t write_pnfs_dlm_device(struct file *file, char *buf, size_t size) +{ + ssize_t rv; + + mutex_lock(&nfsd_mutex); + rv = __write_pnfs_dlm_device(file, buf, size); + mutex_unlock(&nfsd_mutex); + return rv; +} + +#endif /* CONFIG_PNFSD */ + /*----------------------------------------------------------------------------*/ /* * populating the filesystem. @@ -1068,6 +1137,10 @@ static int nfsd_fill_super(struct super_block * sb, void * data, int silent) [NFSD_Gracetime] = {"nfsv4gracetime", &transaction_ops, S_IWUSR|S_IRUSR}, [NFSD_RecoveryDir] = {"nfsv4recoverydir", &transaction_ops, S_IWUSR|S_IRUSR}, #endif +#ifdef CONFIG_PNFSD + [NFSD_pnfs_dlm_device] = {"pnfs_dlm_device", &transaction_ops, + S_IWUSR|S_IRUSR}, +#endif /* last one */ {""} }; struct net *net = data;