pNFS/flexfiles: Don't attempt to send layoutstats if there are no entries
authorTrond Myklebust <trond.myklebust@primarydata.com>
Fri, 25 Nov 2016 18:24:09 +0000 (13:24 -0500)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Fri, 2 Dec 2016 16:42:58 +0000 (11:42 -0500)
If the list of mirrors is empty, then don't send an RPC call.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/flexfilelayout/flexfilelayout.c

index 90462a2a92378aac6ba6e191f9da09bad0f48f1a..a6264d6836dc41d841592721000eadeeb3d38b8e 100644 (file)
@@ -2250,6 +2250,11 @@ ff_layout_prepare_layoutstats(struct nfs42_layoutstat_args *args)
        args->num_dev = ff_layout_mirror_prepare_stats(args,
                        &ff_layout->generic_hdr, dev_count);
        spin_unlock(&args->inode->i_lock);
+       if (!args->num_dev) {
+               kfree(args->devinfo);
+               args->devinfo = NULL;
+               return -ENOENT;
+       }
 
        return 0;
 }