afs: Wrap most op->error accesses with inline funcs
Wrap most op->error accesses with inline funcs which will make it easier for a subsequent patch to replace op->error with something else. Two functions are added to this end: (1) afs_op_error() - Get the error code. (2) afs_op_set_error() - Set the error code. Signed-off-by: David Howells <dhowells@redhat.com> cc: Marc Dionne <marc.dionne@auristor.com> cc: linux-afs@lists.infradead.org
This commit is contained in:
parent
075171fd22
commit
2de5599f63
38
fs/afs/dir.c
38
fs/afs/dir.c
|
@ -878,14 +878,14 @@ static struct inode *afs_do_lookup(struct inode *dir, struct dentry *dentry,
|
||||||
* lookups contained therein are stored in the reply without aborting
|
* lookups contained therein are stored in the reply without aborting
|
||||||
* the whole operation.
|
* the whole operation.
|
||||||
*/
|
*/
|
||||||
op->error = -ENOTSUPP;
|
afs_op_set_error(op, -ENOTSUPP);
|
||||||
if (!cookie->one_only) {
|
if (!cookie->one_only) {
|
||||||
op->ops = &afs_inline_bulk_status_operation;
|
op->ops = &afs_inline_bulk_status_operation;
|
||||||
afs_begin_vnode_operation(op);
|
afs_begin_vnode_operation(op);
|
||||||
afs_wait_for_operation(op);
|
afs_wait_for_operation(op);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (op->error == -ENOTSUPP) {
|
if (afs_op_error(op) == -ENOTSUPP) {
|
||||||
/* We could try FS.BulkStatus next, but this aborts the entire
|
/* We could try FS.BulkStatus next, but this aborts the entire
|
||||||
* op if any of the lookups fails - so, for the moment, revert
|
* op if any of the lookups fails - so, for the moment, revert
|
||||||
* to FS.FetchStatus for op->file[1].
|
* to FS.FetchStatus for op->file[1].
|
||||||
|
@ -895,10 +895,10 @@ static struct inode *afs_do_lookup(struct inode *dir, struct dentry *dentry,
|
||||||
afs_begin_vnode_operation(op);
|
afs_begin_vnode_operation(op);
|
||||||
afs_wait_for_operation(op);
|
afs_wait_for_operation(op);
|
||||||
}
|
}
|
||||||
inode = ERR_PTR(op->error);
|
inode = ERR_PTR(afs_op_error(op));
|
||||||
|
|
||||||
out_op:
|
out_op:
|
||||||
if (op->error == 0) {
|
if (!afs_op_error(op)) {
|
||||||
inode = &op->file[1].vnode->netfs.inode;
|
inode = &op->file[1].vnode->netfs.inode;
|
||||||
op->file[1].vnode = NULL;
|
op->file[1].vnode = NULL;
|
||||||
}
|
}
|
||||||
|
@ -1273,7 +1273,7 @@ static void afs_vnode_new_inode(struct afs_operation *op)
|
||||||
|
|
||||||
_enter("");
|
_enter("");
|
||||||
|
|
||||||
ASSERTCMP(op->error, ==, 0);
|
ASSERTCMP(afs_op_error(op), ==, 0);
|
||||||
|
|
||||||
inode = afs_iget(op, vp);
|
inode = afs_iget(op, vp);
|
||||||
if (IS_ERR(inode)) {
|
if (IS_ERR(inode)) {
|
||||||
|
@ -1286,7 +1286,7 @@ static void afs_vnode_new_inode(struct afs_operation *op)
|
||||||
|
|
||||||
vnode = AFS_FS_I(inode);
|
vnode = AFS_FS_I(inode);
|
||||||
set_bit(AFS_VNODE_NEW_CONTENT, &vnode->flags);
|
set_bit(AFS_VNODE_NEW_CONTENT, &vnode->flags);
|
||||||
if (!op->error)
|
if (!afs_op_error(op))
|
||||||
afs_cache_permit(vnode, op->key, vnode->cb_break, &vp->scb);
|
afs_cache_permit(vnode, op->key, vnode->cb_break, &vp->scb);
|
||||||
d_instantiate(op->dentry, inode);
|
d_instantiate(op->dentry, inode);
|
||||||
}
|
}
|
||||||
|
@ -1320,7 +1320,7 @@ static void afs_create_put(struct afs_operation *op)
|
||||||
{
|
{
|
||||||
_enter("op=%08x", op->debug_id);
|
_enter("op=%08x", op->debug_id);
|
||||||
|
|
||||||
if (op->error)
|
if (afs_op_error(op))
|
||||||
d_drop(op->dentry);
|
d_drop(op->dentry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1480,7 +1480,7 @@ static void afs_dir_remove_link(struct afs_operation *op)
|
||||||
struct dentry *dentry = op->dentry;
|
struct dentry *dentry = op->dentry;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (op->error != 0 ||
|
if (afs_op_error(op) ||
|
||||||
(op->file[1].scb.have_status && op->file[1].scb.have_error))
|
(op->file[1].scb.have_status && op->file[1].scb.have_error))
|
||||||
return;
|
return;
|
||||||
if (d_really_is_positive(dentry))
|
if (d_really_is_positive(dentry))
|
||||||
|
@ -1504,10 +1504,10 @@ static void afs_dir_remove_link(struct afs_operation *op)
|
||||||
|
|
||||||
ret = afs_validate(vnode, op->key);
|
ret = afs_validate(vnode, op->key);
|
||||||
if (ret != -ESTALE)
|
if (ret != -ESTALE)
|
||||||
op->error = ret;
|
afs_op_set_error(op, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
_debug("nlink %d [val %d]", vnode->netfs.inode.i_nlink, op->error);
|
_debug("nlink %d [val %d]", vnode->netfs.inode.i_nlink, afs_op_error(op));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void afs_unlink_success(struct afs_operation *op)
|
static void afs_unlink_success(struct afs_operation *op)
|
||||||
|
@ -1538,7 +1538,7 @@ static void afs_unlink_edit_dir(struct afs_operation *op)
|
||||||
static void afs_unlink_put(struct afs_operation *op)
|
static void afs_unlink_put(struct afs_operation *op)
|
||||||
{
|
{
|
||||||
_enter("op=%08x", op->debug_id);
|
_enter("op=%08x", op->debug_id);
|
||||||
if (op->unlink.need_rehash && op->error < 0 && op->error != -ENOENT)
|
if (op->unlink.need_rehash && afs_op_error(op) < 0 && afs_op_error(op) != -ENOENT)
|
||||||
d_rehash(op->dentry);
|
d_rehash(op->dentry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1579,7 +1579,7 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry)
|
||||||
/* Try to make sure we have a callback promise on the victim. */
|
/* Try to make sure we have a callback promise on the victim. */
|
||||||
ret = afs_validate(vnode, op->key);
|
ret = afs_validate(vnode, op->key);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
op->error = ret;
|
afs_op_set_error(op, ret);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1588,7 +1588,7 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry)
|
||||||
spin_unlock(&dentry->d_lock);
|
spin_unlock(&dentry->d_lock);
|
||||||
/* Start asynchronous writeout of the inode */
|
/* Start asynchronous writeout of the inode */
|
||||||
write_inode_now(d_inode(dentry), 0);
|
write_inode_now(d_inode(dentry), 0);
|
||||||
op->error = afs_sillyrename(dvnode, vnode, dentry, op->key);
|
afs_op_set_error(op, afs_sillyrename(dvnode, vnode, dentry, op->key));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (!d_unhashed(dentry)) {
|
if (!d_unhashed(dentry)) {
|
||||||
|
@ -1609,7 +1609,7 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry)
|
||||||
/* If there was a conflict with a third party, check the status of the
|
/* If there was a conflict with a third party, check the status of the
|
||||||
* unlinked vnode.
|
* unlinked vnode.
|
||||||
*/
|
*/
|
||||||
if (op->error == 0 && (op->flags & AFS_OPERATION_DIR_CONFLICT)) {
|
if (afs_op_error(op) == 0 && (op->flags & AFS_OPERATION_DIR_CONFLICT)) {
|
||||||
op->file[1].update_ctime = false;
|
op->file[1].update_ctime = false;
|
||||||
op->fetch_status.which = 1;
|
op->fetch_status.which = 1;
|
||||||
op->ops = &afs_fetch_status_operation;
|
op->ops = &afs_fetch_status_operation;
|
||||||
|
@ -1691,7 +1691,7 @@ static void afs_link_success(struct afs_operation *op)
|
||||||
static void afs_link_put(struct afs_operation *op)
|
static void afs_link_put(struct afs_operation *op)
|
||||||
{
|
{
|
||||||
_enter("op=%08x", op->debug_id);
|
_enter("op=%08x", op->debug_id);
|
||||||
if (op->error)
|
if (afs_op_error(op))
|
||||||
d_drop(op->dentry);
|
d_drop(op->dentry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1889,7 +1889,7 @@ static void afs_rename_put(struct afs_operation *op)
|
||||||
if (op->rename.rehash)
|
if (op->rename.rehash)
|
||||||
d_rehash(op->rename.rehash);
|
d_rehash(op->rename.rehash);
|
||||||
dput(op->rename.tmp);
|
dput(op->rename.tmp);
|
||||||
if (op->error)
|
if (afs_op_error(op))
|
||||||
d_rehash(op->dentry);
|
d_rehash(op->dentry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1934,7 +1934,7 @@ static int afs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
|
||||||
return PTR_ERR(op);
|
return PTR_ERR(op);
|
||||||
|
|
||||||
ret = afs_validate(vnode, op->key);
|
ret = afs_validate(vnode, op->key);
|
||||||
op->error = ret;
|
afs_op_set_error(op, ret);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
@ -1971,7 +1971,7 @@ static int afs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
|
||||||
op->rename.tmp = d_alloc(new_dentry->d_parent,
|
op->rename.tmp = d_alloc(new_dentry->d_parent,
|
||||||
&new_dentry->d_name);
|
&new_dentry->d_name);
|
||||||
if (!op->rename.tmp) {
|
if (!op->rename.tmp) {
|
||||||
op->error = -ENOMEM;
|
afs_op_nomem(op);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1979,7 +1979,7 @@ static int afs_rename(struct mnt_idmap *idmap, struct inode *old_dir,
|
||||||
AFS_FS_I(d_inode(new_dentry)),
|
AFS_FS_I(d_inode(new_dentry)),
|
||||||
new_dentry, op->key);
|
new_dentry, op->key);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
op->error = ret;
|
afs_op_set_error(op, ret);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -243,7 +243,7 @@ static void afs_fetch_data_notify(struct afs_operation *op)
|
||||||
{
|
{
|
||||||
struct afs_read *req = op->fetch.req;
|
struct afs_read *req = op->fetch.req;
|
||||||
struct netfs_io_subrequest *subreq = req->subreq;
|
struct netfs_io_subrequest *subreq = req->subreq;
|
||||||
int error = op->error;
|
int error = afs_op_error(op);
|
||||||
|
|
||||||
if (error == -ECONNABORTED)
|
if (error == -ECONNABORTED)
|
||||||
error = afs_abort_to_error(op->ac.abort_code);
|
error = afs_abort_to_error(op->ac.abort_code);
|
||||||
|
@ -271,7 +271,7 @@ static void afs_fetch_data_success(struct afs_operation *op)
|
||||||
|
|
||||||
static void afs_fetch_data_put(struct afs_operation *op)
|
static void afs_fetch_data_put(struct afs_operation *op)
|
||||||
{
|
{
|
||||||
op->fetch.req->error = op->error;
|
op->fetch.req->error = afs_op_error(op);
|
||||||
afs_put_read(op->fetch.req);
|
afs_put_read(op->fetch.req);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,8 +40,8 @@ struct afs_operation *afs_alloc_operation(struct key *key, struct afs_volume *vo
|
||||||
op->net = volume->cell->net;
|
op->net = volume->cell->net;
|
||||||
op->cb_v_break = volume->cb_v_break;
|
op->cb_v_break = volume->cb_v_break;
|
||||||
op->debug_id = atomic_inc_return(&afs_operation_debug_counter);
|
op->debug_id = atomic_inc_return(&afs_operation_debug_counter);
|
||||||
op->error = -EDESTADDRREQ;
|
|
||||||
op->nr_iterations = -1;
|
op->nr_iterations = -1;
|
||||||
|
afs_op_set_error(op, -EDESTADDRREQ);
|
||||||
|
|
||||||
_leave(" = [op=%08x]", op->debug_id);
|
_leave(" = [op=%08x]", op->debug_id);
|
||||||
return op;
|
return op;
|
||||||
|
@ -71,7 +71,7 @@ static bool afs_get_io_locks(struct afs_operation *op)
|
||||||
swap(vnode, vnode2);
|
swap(vnode, vnode2);
|
||||||
|
|
||||||
if (mutex_lock_interruptible(&vnode->io_lock) < 0) {
|
if (mutex_lock_interruptible(&vnode->io_lock) < 0) {
|
||||||
op->error = -ERESTARTSYS;
|
afs_op_set_error(op, -ERESTARTSYS);
|
||||||
op->flags |= AFS_OPERATION_STOP;
|
op->flags |= AFS_OPERATION_STOP;
|
||||||
_leave(" = f [I 0]");
|
_leave(" = f [I 0]");
|
||||||
return false;
|
return false;
|
||||||
|
@ -80,7 +80,7 @@ static bool afs_get_io_locks(struct afs_operation *op)
|
||||||
|
|
||||||
if (vnode2) {
|
if (vnode2) {
|
||||||
if (mutex_lock_interruptible_nested(&vnode2->io_lock, 1) < 0) {
|
if (mutex_lock_interruptible_nested(&vnode2->io_lock, 1) < 0) {
|
||||||
op->error = -ERESTARTSYS;
|
afs_op_set_error(op, -ERESTARTSYS);
|
||||||
op->flags |= AFS_OPERATION_STOP;
|
op->flags |= AFS_OPERATION_STOP;
|
||||||
mutex_unlock(&vnode->io_lock);
|
mutex_unlock(&vnode->io_lock);
|
||||||
op->flags &= ~AFS_OPERATION_LOCK_0;
|
op->flags &= ~AFS_OPERATION_LOCK_0;
|
||||||
|
@ -159,11 +159,14 @@ static void afs_end_vnode_operation(struct afs_operation *op)
|
||||||
{
|
{
|
||||||
_enter("");
|
_enter("");
|
||||||
|
|
||||||
if (op->error == -EDESTADDRREQ ||
|
switch (afs_op_error(op)) {
|
||||||
op->error == -EADDRNOTAVAIL ||
|
case -EDESTADDRREQ:
|
||||||
op->error == -ENETUNREACH ||
|
case -EADDRNOTAVAIL:
|
||||||
op->error == -EHOSTUNREACH)
|
case -ENETUNREACH:
|
||||||
|
case -EHOSTUNREACH:
|
||||||
afs_dump_edestaddrreq(op);
|
afs_dump_edestaddrreq(op);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
afs_drop_io_locks(op);
|
afs_drop_io_locks(op);
|
||||||
|
|
||||||
|
@ -209,7 +212,7 @@ void afs_wait_for_operation(struct afs_operation *op)
|
||||||
|
|
||||||
afs_end_vnode_operation(op);
|
afs_end_vnode_operation(op);
|
||||||
|
|
||||||
if (op->error == 0 && op->ops->edit_dir) {
|
if (!afs_op_error(op) && op->ops->edit_dir) {
|
||||||
_debug("edit_dir");
|
_debug("edit_dir");
|
||||||
op->ops->edit_dir(op);
|
op->ops->edit_dir(op);
|
||||||
}
|
}
|
||||||
|
@ -221,7 +224,7 @@ void afs_wait_for_operation(struct afs_operation *op)
|
||||||
*/
|
*/
|
||||||
int afs_put_operation(struct afs_operation *op)
|
int afs_put_operation(struct afs_operation *op)
|
||||||
{
|
{
|
||||||
int i, ret = op->error;
|
int i, ret = afs_op_error(op);
|
||||||
|
|
||||||
_enter("op=%08x,%d", op->debug_id, ret);
|
_enter("op=%08x,%d", op->debug_id, ret);
|
||||||
|
|
||||||
|
|
|
@ -1899,7 +1899,7 @@ void afs_fs_inline_bulk_status(struct afs_operation *op)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (test_bit(AFS_SERVER_FL_NO_IBULK, &op->server->flags)) {
|
if (test_bit(AFS_SERVER_FL_NO_IBULK, &op->server->flags)) {
|
||||||
op->error = -ENOTSUPP;
|
afs_op_set_error(op, -ENOTSUPP);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -331,7 +331,7 @@ static void afs_fetch_status_success(struct afs_operation *op)
|
||||||
|
|
||||||
if (vnode->netfs.inode.i_state & I_NEW) {
|
if (vnode->netfs.inode.i_state & I_NEW) {
|
||||||
ret = afs_inode_init_from_status(op, vp, vnode);
|
ret = afs_inode_init_from_status(op, vp, vnode);
|
||||||
op->error = ret;
|
afs_op_set_error(op, ret);
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
afs_cache_permit(vnode, op->key, vp->cb_break_before, &vp->scb);
|
afs_cache_permit(vnode, op->key, vp->cb_break_before, &vp->scb);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1140,11 +1140,6 @@ extern bool afs_begin_vnode_operation(struct afs_operation *);
|
||||||
extern void afs_wait_for_operation(struct afs_operation *);
|
extern void afs_wait_for_operation(struct afs_operation *);
|
||||||
extern int afs_do_sync_operation(struct afs_operation *);
|
extern int afs_do_sync_operation(struct afs_operation *);
|
||||||
|
|
||||||
static inline void afs_op_nomem(struct afs_operation *op)
|
|
||||||
{
|
|
||||||
op->error = -ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void afs_op_set_vnode(struct afs_operation *op, unsigned int n,
|
static inline void afs_op_set_vnode(struct afs_operation *op, unsigned int n,
|
||||||
struct afs_vnode *vnode)
|
struct afs_vnode *vnode)
|
||||||
{
|
{
|
||||||
|
@ -1238,6 +1233,21 @@ static inline void __afs_stat(atomic_t *s)
|
||||||
extern int afs_abort_to_error(u32);
|
extern int afs_abort_to_error(u32);
|
||||||
extern void afs_prioritise_error(struct afs_error *, int, u32);
|
extern void afs_prioritise_error(struct afs_error *, int, u32);
|
||||||
|
|
||||||
|
static inline void afs_op_nomem(struct afs_operation *op)
|
||||||
|
{
|
||||||
|
op->error = -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int afs_op_error(const struct afs_operation *op)
|
||||||
|
{
|
||||||
|
return op->error;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int afs_op_set_error(struct afs_operation *op, int error)
|
||||||
|
{
|
||||||
|
return op->error = error;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* mntpt.c
|
* mntpt.c
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -51,7 +51,7 @@ static bool afs_start_fs_iteration(struct afs_operation *op,
|
||||||
* and have to return an error.
|
* and have to return an error.
|
||||||
*/
|
*/
|
||||||
if (op->flags & AFS_OPERATION_CUR_ONLY) {
|
if (op->flags & AFS_OPERATION_CUR_ONLY) {
|
||||||
op->error = -ESTALE;
|
afs_op_set_error(op, -ESTALE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ static bool afs_sleep_and_retry(struct afs_operation *op)
|
||||||
if (!(op->flags & AFS_OPERATION_UNINTR)) {
|
if (!(op->flags & AFS_OPERATION_UNINTR)) {
|
||||||
msleep_interruptible(1000);
|
msleep_interruptible(1000);
|
||||||
if (signal_pending(current)) {
|
if (signal_pending(current)) {
|
||||||
op->error = -ERESTARTSYS;
|
afs_op_set_error(op, -ERESTARTSYS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -137,7 +137,7 @@ bool afs_select_fileserver(struct afs_operation *op)
|
||||||
case 0:
|
case 0:
|
||||||
default:
|
default:
|
||||||
/* Success or local failure. Stop. */
|
/* Success or local failure. Stop. */
|
||||||
op->error = error;
|
afs_op_set_error(op, error);
|
||||||
op->flags |= AFS_OPERATION_STOP;
|
op->flags |= AFS_OPERATION_STOP;
|
||||||
_leave(" = f [okay/local %d]", error);
|
_leave(" = f [okay/local %d]", error);
|
||||||
return false;
|
return false;
|
||||||
|
@ -174,11 +174,13 @@ bool afs_select_fileserver(struct afs_operation *op)
|
||||||
|
|
||||||
set_bit(AFS_VOLUME_NEEDS_UPDATE, &op->volume->flags);
|
set_bit(AFS_VOLUME_NEEDS_UPDATE, &op->volume->flags);
|
||||||
error = afs_check_volume_status(op->volume, op);
|
error = afs_check_volume_status(op->volume, op);
|
||||||
if (error < 0)
|
if (error < 0) {
|
||||||
goto failed_set_error;
|
afs_op_set_error(op, error);
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
|
||||||
if (test_bit(AFS_VOLUME_DELETED, &op->volume->flags)) {
|
if (test_bit(AFS_VOLUME_DELETED, &op->volume->flags)) {
|
||||||
op->error = -ENOMEDIUM;
|
afs_op_set_error(op, -ENOMEDIUM);
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,11 +252,11 @@ bool afs_select_fileserver(struct afs_operation *op)
|
||||||
clear_bit(AFS_VOLUME_BUSY, &op->volume->flags);
|
clear_bit(AFS_VOLUME_BUSY, &op->volume->flags);
|
||||||
}
|
}
|
||||||
if (op->flags & AFS_OPERATION_NO_VSLEEP) {
|
if (op->flags & AFS_OPERATION_NO_VSLEEP) {
|
||||||
op->error = -EADV;
|
afs_op_set_error(op, -EADV);
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
if (op->flags & AFS_OPERATION_CUR_ONLY) {
|
if (op->flags & AFS_OPERATION_CUR_ONLY) {
|
||||||
op->error = -ESTALE;
|
afs_op_set_error(op, -ESTALE);
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
goto busy;
|
goto busy;
|
||||||
|
@ -275,7 +277,7 @@ bool afs_select_fileserver(struct afs_operation *op)
|
||||||
* lock we need to maintain.
|
* lock we need to maintain.
|
||||||
*/
|
*/
|
||||||
if (op->flags & AFS_OPERATION_NO_VSLEEP) {
|
if (op->flags & AFS_OPERATION_NO_VSLEEP) {
|
||||||
op->error = -EBUSY;
|
afs_op_set_error(op, -EBUSY);
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
if (!test_and_set_bit(AFS_VOLUME_BUSY, &op->volume->flags)) {
|
if (!test_and_set_bit(AFS_VOLUME_BUSY, &op->volume->flags)) {
|
||||||
|
@ -304,7 +306,7 @@ bool afs_select_fileserver(struct afs_operation *op)
|
||||||
* honour, just in case someone sets up a loop.
|
* honour, just in case someone sets up a loop.
|
||||||
*/
|
*/
|
||||||
if (op->flags & AFS_OPERATION_VMOVED) {
|
if (op->flags & AFS_OPERATION_VMOVED) {
|
||||||
op->error = -EREMOTEIO;
|
afs_op_set_error(op, -EREMOTEIO);
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
op->flags |= AFS_OPERATION_VMOVED;
|
op->flags |= AFS_OPERATION_VMOVED;
|
||||||
|
@ -312,8 +314,10 @@ bool afs_select_fileserver(struct afs_operation *op)
|
||||||
set_bit(AFS_VOLUME_WAIT, &op->volume->flags);
|
set_bit(AFS_VOLUME_WAIT, &op->volume->flags);
|
||||||
set_bit(AFS_VOLUME_NEEDS_UPDATE, &op->volume->flags);
|
set_bit(AFS_VOLUME_NEEDS_UPDATE, &op->volume->flags);
|
||||||
error = afs_check_volume_status(op->volume, op);
|
error = afs_check_volume_status(op->volume, op);
|
||||||
if (error < 0)
|
if (error < 0) {
|
||||||
goto failed_set_error;
|
afs_op_set_error(op, error);
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
|
||||||
/* If the server list didn't change, then the VLDB is
|
/* If the server list didn't change, then the VLDB is
|
||||||
* out of sync with the fileservers. This is hopefully
|
* out of sync with the fileservers. This is hopefully
|
||||||
|
@ -344,7 +348,7 @@ bool afs_select_fileserver(struct afs_operation *op)
|
||||||
* Translate locally and return ENOSPC.
|
* Translate locally and return ENOSPC.
|
||||||
* No replicas to failover to.
|
* No replicas to failover to.
|
||||||
*/
|
*/
|
||||||
op->error = -ENOSPC;
|
afs_op_set_error(op, -ENOSPC);
|
||||||
goto failed_but_online;
|
goto failed_but_online;
|
||||||
|
|
||||||
case VOVERQUOTA:
|
case VOVERQUOTA:
|
||||||
|
@ -353,7 +357,7 @@ bool afs_select_fileserver(struct afs_operation *op)
|
||||||
* Translate locally and return EDQUOT.
|
* Translate locally and return EDQUOT.
|
||||||
* No replicas to failover to.
|
* No replicas to failover to.
|
||||||
*/
|
*/
|
||||||
op->error = -EDQUOT;
|
afs_op_set_error(op, -EDQUOT);
|
||||||
goto failed_but_online;
|
goto failed_but_online;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -366,7 +370,7 @@ bool afs_select_fileserver(struct afs_operation *op)
|
||||||
|
|
||||||
case -ETIMEDOUT:
|
case -ETIMEDOUT:
|
||||||
case -ETIME:
|
case -ETIME:
|
||||||
if (op->error != -EDESTADDRREQ)
|
if (afs_op_error(op) != -EDESTADDRREQ)
|
||||||
goto iterate_address;
|
goto iterate_address;
|
||||||
fallthrough;
|
fallthrough;
|
||||||
case -ERFKILL:
|
case -ERFKILL:
|
||||||
|
@ -385,7 +389,7 @@ bool afs_select_fileserver(struct afs_operation *op)
|
||||||
fallthrough;
|
fallthrough;
|
||||||
case -ECONNRESET:
|
case -ECONNRESET:
|
||||||
_debug("call reset");
|
_debug("call reset");
|
||||||
op->error = error;
|
afs_op_set_error(op, error);
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,8 +405,10 @@ start:
|
||||||
* volume may have moved or even have been deleted.
|
* volume may have moved or even have been deleted.
|
||||||
*/
|
*/
|
||||||
error = afs_check_volume_status(op->volume, op);
|
error = afs_check_volume_status(op->volume, op);
|
||||||
if (error < 0)
|
if (error < 0) {
|
||||||
goto failed_set_error;
|
afs_op_set_error(op, error);
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
|
||||||
if (!afs_start_fs_iteration(op, vnode))
|
if (!afs_start_fs_iteration(op, vnode))
|
||||||
goto failed;
|
goto failed;
|
||||||
|
@ -413,8 +419,10 @@ pick_server:
|
||||||
_debug("pick [%lx]", op->untried);
|
_debug("pick [%lx]", op->untried);
|
||||||
|
|
||||||
error = afs_wait_for_fs_probes(op->server_list, op->untried);
|
error = afs_wait_for_fs_probes(op->server_list, op->untried);
|
||||||
if (error < 0)
|
if (error < 0) {
|
||||||
goto failed_set_error;
|
afs_op_set_error(op, error);
|
||||||
|
goto failed;
|
||||||
|
}
|
||||||
|
|
||||||
/* Pick the untried server with the lowest RTT. If we have outstanding
|
/* Pick the untried server with the lowest RTT. If we have outstanding
|
||||||
* callbacks, we stick with the server we're already using if we can.
|
* callbacks, we stick with the server we're already using if we can.
|
||||||
|
@ -515,7 +523,8 @@ out_of_addresses:
|
||||||
op->flags &= ~AFS_OPERATION_RETRY_SERVER;
|
op->flags &= ~AFS_OPERATION_RETRY_SERVER;
|
||||||
goto retry_server;
|
goto retry_server;
|
||||||
case -ERESTARTSYS:
|
case -ERESTARTSYS:
|
||||||
goto failed_set_error;
|
afs_op_set_error(op, error);
|
||||||
|
goto failed;
|
||||||
case -ETIME:
|
case -ETIME:
|
||||||
case -EDESTADDRREQ:
|
case -EDESTADDRREQ:
|
||||||
goto next_server;
|
goto next_server;
|
||||||
|
@ -544,13 +553,11 @@ no_more_servers:
|
||||||
}
|
}
|
||||||
|
|
||||||
error = e.error;
|
error = e.error;
|
||||||
|
|
||||||
failed_set_error:
|
|
||||||
op->error = error;
|
op->error = error;
|
||||||
failed:
|
failed:
|
||||||
op->flags |= AFS_OPERATION_STOP;
|
op->flags |= AFS_OPERATION_STOP;
|
||||||
afs_end_cursor(&op->ac);
|
afs_end_cursor(&op->ac);
|
||||||
_leave(" = f [failed %d]", op->error);
|
_leave(" = f [failed %d]", afs_op_error(op));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -629,8 +629,8 @@ static noinline bool afs_update_server_record(struct afs_operation *op,
|
||||||
_leave(" = t [intr]");
|
_leave(" = t [intr]");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
op->error = PTR_ERR(alist);
|
afs_op_set_error(op, PTR_ERR(alist));
|
||||||
_leave(" = f [%d]", op->error);
|
_leave(" = f [%d]", afs_op_error(op));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -684,7 +684,7 @@ wait:
|
||||||
(op->flags & AFS_OPERATION_UNINTR) ?
|
(op->flags & AFS_OPERATION_UNINTR) ?
|
||||||
TASK_UNINTERRUPTIBLE : TASK_INTERRUPTIBLE);
|
TASK_UNINTERRUPTIBLE : TASK_INTERRUPTIBLE);
|
||||||
if (ret == -ERESTARTSYS) {
|
if (ret == -ERESTARTSYS) {
|
||||||
op->error = ret;
|
afs_op_set_error(op, ret);
|
||||||
_leave(" = f [intr]");
|
_leave(" = f [intr]");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -366,7 +366,7 @@ static void afs_store_data_success(struct afs_operation *op)
|
||||||
|
|
||||||
op->ctime = op->file[0].scb.status.mtime_client;
|
op->ctime = op->file[0].scb.status.mtime_client;
|
||||||
afs_vnode_commit_status(op, &op->file[0]);
|
afs_vnode_commit_status(op, &op->file[0]);
|
||||||
if (op->error == 0) {
|
if (!afs_op_error(op)) {
|
||||||
if (!op->store.laundering)
|
if (!op->store.laundering)
|
||||||
afs_pages_written_back(vnode, op->store.pos, op->store.size);
|
afs_pages_written_back(vnode, op->store.pos, op->store.size);
|
||||||
afs_stat_v(vnode, n_stores);
|
afs_stat_v(vnode, n_stores);
|
||||||
|
@ -428,7 +428,7 @@ try_next_key:
|
||||||
|
|
||||||
afs_wait_for_operation(op);
|
afs_wait_for_operation(op);
|
||||||
|
|
||||||
switch (op->error) {
|
switch (afs_op_error(op)) {
|
||||||
case -EACCES:
|
case -EACCES:
|
||||||
case -EPERM:
|
case -EPERM:
|
||||||
case -ENOKEY:
|
case -ENOKEY:
|
||||||
|
@ -447,7 +447,7 @@ try_next_key:
|
||||||
}
|
}
|
||||||
|
|
||||||
afs_put_wb_key(wbk);
|
afs_put_wb_key(wbk);
|
||||||
_leave(" = %d", op->error);
|
_leave(" = %d", afs_op_error(op));
|
||||||
return afs_put_operation(op);
|
return afs_put_operation(op);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue