Merge tag 'mm-stable-2023-04-27-15-30' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-block.git] / fs / netfs / buffered_read.c
index 7679a68e8193070bdf22e3554c102e25bf6621e2..3404707ddbe7302201288e793287a1de5c5e24e7 100644 (file)
@@ -341,17 +341,16 @@ int netfs_write_begin(struct netfs_inode *ctx,
 {
        struct netfs_io_request *rreq;
        struct folio *folio;
-       unsigned int fgp_flags = FGP_LOCK | FGP_WRITE | FGP_CREAT | FGP_STABLE;
        pgoff_t index = pos >> PAGE_SHIFT;
        int ret;
 
        DEFINE_READAHEAD(ractl, file, NULL, mapping, index);
 
 retry:
-       folio = __filemap_get_folio(mapping, index, fgp_flags,
+       folio = __filemap_get_folio(mapping, index, FGP_WRITEBEGIN,
                                    mapping_gfp_mask(mapping));
-       if (!folio)
-               return -ENOMEM;
+       if (IS_ERR(folio))
+               return PTR_ERR(folio);
 
        if (ctx->ops->check_write_begin) {
                /* Allow the netfs (eg. ceph) to flush conflicts. */