Merge tag 'xfs-for-linus-3.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
[firefly-linux-kernel-4.4.55.git] / fs / nfs / callback_proc.c
index 41db5258e7a7a5ef837ebd11ae605f7144bd4e65..73466b934090667c3469947e536e80804b6e8cb7 100644 (file)
@@ -171,14 +171,26 @@ static u32 initiate_file_draining(struct nfs_client *clp,
                goto out;
 
        ino = lo->plh_inode;
+
+       spin_lock(&ino->i_lock);
+       pnfs_set_layout_stateid(lo, &args->cbl_stateid, true);
+       spin_unlock(&ino->i_lock);
+
+       pnfs_layoutcommit_inode(ino, false);
+
        spin_lock(&ino->i_lock);
        if (test_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags) ||
            pnfs_mark_matching_lsegs_invalid(lo, &free_me_list,
-                                       &args->cbl_range))
+                                       &args->cbl_range)) {
                rv = NFS4ERR_DELAY;
-       else
-               rv = NFS4ERR_NOMATCHING_LAYOUT;
-       pnfs_set_layout_stateid(lo, &args->cbl_stateid, true);
+               goto unlock;
+       }
+
+       if (NFS_SERVER(ino)->pnfs_curr_ld->return_range) {
+               NFS_SERVER(ino)->pnfs_curr_ld->return_range(lo,
+                       &args->cbl_range);
+       }
+unlock:
        spin_unlock(&ino->i_lock);
        pnfs_free_lseg_list(&free_me_list);
        pnfs_put_layout_hdr(lo);
@@ -277,9 +289,6 @@ __be32 nfs4_callback_devicenotify(struct cb_devicenotifyargs *args,
                }
 
        found:
-               if (dev->cbd_notify_type == NOTIFY_DEVICEID4_CHANGE)
-                       dprintk("%s: NOTIFY_DEVICEID4_CHANGE not supported, "
-                               "deleting instead\n", __func__);
                nfs4_delete_deviceid(server->pnfs_curr_ld, clp, &dev->cbd_dev_id);
        }