Merge tag 'ceph-for-5.16-rc1' of git://github.com/ceph/ceph-client
[sfrench/cifs-2.6.git] / fs / ceph / locks.c
index d8c31069fbf2b9eed2ec3e8825f7f4dae9ac4856..d1f154aec249bf3d38fb8d10dd66c311065fdb68 100644 (file)
@@ -241,6 +241,9 @@ int ceph_lock(struct file *file, int cmd, struct file_lock *fl)
        if (!(fl->fl_flags & FL_POSIX))
                return -ENOLCK;
 
+       if (ceph_inode_is_shutdown(inode))
+               return -ESTALE;
+
        dout("ceph_lock, fl_owner: %p\n", fl->fl_owner);
 
        /* set wait bit as appropriate, then make command as Ceph expects it*/
@@ -303,6 +306,9 @@ int ceph_flock(struct file *file, int cmd, struct file_lock *fl)
        if (!(fl->fl_flags & FL_FLOCK))
                return -ENOLCK;
 
+       if (ceph_inode_is_shutdown(inode))
+               return -ESTALE;
+
        dout("ceph_flock, fl_file: %p\n", fl->fl_file);
 
        spin_lock(&ci->i_ceph_lock);