Return-Path: Received: from fieldses.org ([174.143.236.118]:48164 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758287Ab0FJNdh (ORCPT ); Thu, 10 Jun 2010 09:33:37 -0400 Date: Thu, 10 Jun 2010 09:33:37 -0400 To: Benny Halevy Cc: linux-nfs@vger.kernel.org Subject: [PATCH] Fixed getdevinfo() and dlm_ino_hash() to search for the correct disk name. Message-ID: <20100610133336.GB24596@fieldses.org> Content-Type: text/plain; charset=us-ascii From: "J. Bruce Fields" Sender: linux-nfs-owner@vger.kernel.org List-ID: MIME-Version: 1.0 The patch "pnfsd: fix test in nfsd4_find_pnfs_dlm_device" was obviously correct; before that patch, nfsd4_find_pnfs_dlm_device() returned the first device which did *not* match, instead of the first device which did. Other callers previous worked because they passed int the incorrect name, and because we never had more than one element in the list, so returning the first non-match would return the right thing. But now we need to fix those callers. From: Eric Anderle --- fs/nfsd/nfs4pnfsdlm.c | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/fs/nfsd/nfs4pnfsdlm.c b/fs/nfsd/nfs4pnfsdlm.c index 84caa6e..5a66a71 100644 --- a/fs/nfsd/nfs4pnfsdlm.c +++ b/fs/nfsd/nfs4pnfsdlm.c @@ -268,10 +268,13 @@ static int nfsd4_pnfs_dlm_getdevinfo(struct super_block *sb, /* * If the DS list has not been established, return -EINVAL */ - dlm_pdev = nfsd4_find_pnfs_dlm_device(sb->s_bdev->bd_disk->disk_name); + /* Long enough to hold "/dev/" + disk name */ + char full_disk_name[6 + strlen(sb->s_bdev->bd_disk->disk_name)]; + sprintf(full_disk_name, "/dev/%s", sb->s_bdev->bd_disk->disk_name); + dlm_pdev = nfsd4_find_pnfs_dlm_device(full_disk_name); if (!dlm_pdev) { dprintk("%s: DEBUG: disk %s Not Found\n", __func__, - sb->s_bdev->bd_disk->disk_name); + full_disk_name); return err; } @@ -364,7 +367,10 @@ static int dlm_ino_hash(struct inode *ino) /* If can't find the inode block device in the pnfs_dlm_deivce list * then don't hand out a layout */ - de = nfsd4_find_pnfs_dlm_device(ino->i_sb->s_bdev->bd_disk->disk_name); + /* Long enough to hold "/dev/" + disk name */ + char full_disk_name[6 + strlen(ino->i_sb->s_bdev->bd_disk->disk_name)]; + sprintf(full_disk_name, "/dev/%s", ino->i_sb->s_bdev->bd_disk->disk_name); + de = nfsd4_find_pnfs_dlm_device(full_disk_name); if (!de) return -1; hash_mask = de->num_ds - 1; -- 1.7.0.4