Message ID | 20220701022947.10716-3-xiubli@redhat.com |
---|---|
State | New |
Headers | show |
Series | netfs, ceph: fix the crash when unlocking the folio | expand |
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index fe6147f20dee..3ef5200e2005 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c @@ -1310,16 +1310,16 @@ static int ceph_netfs_check_write_begin(struct file *file, loff_t pos, unsigned if (snapc) { int r; - folio_unlock(folio); - folio_put(folio); if (IS_ERR(snapc)) return PTR_ERR(snapc); + folio_unlock(folio); ceph_queue_writeback(inode); r = wait_event_killable(ci->i_cap_wq, context_is_writeable_or_written(inode, snapc)); ceph_put_snap_context(snapc); - return r == 0 ? -EAGAIN : r; + folio_lock(folio); + return r == 0 ? -EAGAIN : 0; } return 0; }