@@ -320,7 +320,7 @@ static bool netfs_skip_folio_read(struct folio *folio, loff_t pos, size_t len,
* pointer to the fsdata cookie that gets returned to the VM to be passed to
* write_end. It is permitted to sleep. It should return 0 if the request
* should go ahead; unlock the folio and return -EAGAIN to cause the folio to
- * be regot; or return an error.
+ * be regot; or unlock the folio and return an error.
*
* The calling netfs must initialise a netfs context contiguous to the vfs
* inode before calling this.
@@ -353,7 +353,7 @@ int netfs_write_begin(struct netfs_inode *ctx,
trace_netfs_failure(NULL, NULL, ret, netfs_fail_check_write_begin);
if (ret == -EAGAIN)
goto retry;
- goto error;
+ goto error_unlocked;
}
}
@@ -375,7 +375,7 @@ int netfs_write_begin(struct netfs_inode *ctx,
NETFS_READ_FOR_WRITE);
if (IS_ERR(rreq)) {
ret = PTR_ERR(rreq);
- goto error;
+ goto error_locked;
}
rreq->no_unlock_folio = folio_index(folio);
__set_bit(NETFS_RREQ_NO_UNLOCK_FOLIO, &rreq->flags);
@@ -402,12 +402,12 @@ int netfs_write_begin(struct netfs_inode *ctx,
ret = netfs_begin_read(rreq, true);
if (ret < 0)
- goto error;
+ goto error_locked;
have_folio:
ret = folio_wait_fscache_killable(folio);
if (ret < 0)
- goto error;
+ goto error_locked;
have_folio_no_wait:
*_folio = folio;
_leave(" = 0");
@@ -415,9 +415,10 @@ int netfs_write_begin(struct netfs_inode *ctx,
error_put:
netfs_put_request(rreq, false, netfs_rreq_trace_put_failed);
-error:
+error_locked:
folio_unlock(folio);
folio_put(folio);
+error_unlocked:
_leave(" = %d", ret);
return ret;
}