forked from luck/tmp_suning_uos_patched
afs: Make some RPC operations non-interruptible
Make certain RPC operations non-interruptible, including:
(*) Set attributes
(*) Store data
We don't want to get interrupted during a flush on close, flush on
unlock, writeback or an inode update, leaving us in a state where we
still need to do the writeback or update.
(*) Extend lock
(*) Release lock
We don't want to get lock extension interrupted as the file locks on
the server are time-limited. Interruption during lock release is less
of an issue since the lock is time-limited, but it's better to
complete the release to avoid a several-minute wait to recover it.
*Setting* the lock isn't a problem if it's interrupted since we can
just return to the user and tell them they were interrupted - at
which point they can elect to retry.
(*) Silly unlink
We want to remove silly unlink files if we can, rather than leaving
them for the salvager to clear up.
Note that whilst these calls are no longer interruptible, they do have
timeouts on them, so if the server stops responding the call will fail with
something like ETIME or ECONNRESET.
Without this, the following:
kAFS: Unexpected error from FS.StoreData -512
appears in dmesg when a pending store data gets interrupted and some
processes may just hang.
Additionally, make the code that checks/updates the server record ignore
failure due to interruption if the main call is uninterruptible and if the
server has an address list. The next op will check it again since the
expiration time on the old list has past.
Fixes: d2ddc776a4
("afs: Overhaul volume and server record caching and fileserver rotation")
Reported-by: Jonathan Billings <jsbillings@jsbillings.org>
Reported-by: Marc Dionne <marc.dionne@auristor.com>
Signed-off-by: David Howells <dhowells@redhat.com>
This commit is contained in:
parent
b960a34b73
commit
20b8391fff
18
fs/afs/dir.c
18
fs/afs/dir.c
|
@ -704,7 +704,7 @@ static struct inode *afs_do_lookup(struct inode *dir, struct dentry *dentry,
|
|||
goto no_inline_bulk_status;
|
||||
|
||||
inode = ERR_PTR(-ERESTARTSYS);
|
||||
if (afs_begin_vnode_operation(&fc, dvnode, key)) {
|
||||
if (afs_begin_vnode_operation(&fc, dvnode, key, true)) {
|
||||
while (afs_select_fileserver(&fc)) {
|
||||
if (test_bit(AFS_SERVER_FL_NO_IBULK,
|
||||
&fc.cbi->server->flags)) {
|
||||
|
@ -739,7 +739,7 @@ static struct inode *afs_do_lookup(struct inode *dir, struct dentry *dentry,
|
|||
*/
|
||||
cookie->nr_fids = 1;
|
||||
inode = ERR_PTR(-ERESTARTSYS);
|
||||
if (afs_begin_vnode_operation(&fc, dvnode, key)) {
|
||||
if (afs_begin_vnode_operation(&fc, dvnode, key, true)) {
|
||||
while (afs_select_fileserver(&fc)) {
|
||||
afs_fs_fetch_status(&fc,
|
||||
afs_v2net(dvnode),
|
||||
|
@ -1166,7 +1166,7 @@ static int afs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
|
|||
}
|
||||
|
||||
ret = -ERESTARTSYS;
|
||||
if (afs_begin_vnode_operation(&fc, dvnode, key)) {
|
||||
if (afs_begin_vnode_operation(&fc, dvnode, key, true)) {
|
||||
while (afs_select_fileserver(&fc)) {
|
||||
fc.cb_break = afs_calc_vnode_cb_break(dvnode);
|
||||
afs_fs_create(&fc, dentry->d_name.name, mode, data_version,
|
||||
|
@ -1250,7 +1250,7 @@ static int afs_rmdir(struct inode *dir, struct dentry *dentry)
|
|||
}
|
||||
|
||||
ret = -ERESTARTSYS;
|
||||
if (afs_begin_vnode_operation(&fc, dvnode, key)) {
|
||||
if (afs_begin_vnode_operation(&fc, dvnode, key, true)) {
|
||||
while (afs_select_fileserver(&fc)) {
|
||||
fc.cb_break = afs_calc_vnode_cb_break(dvnode);
|
||||
afs_fs_remove(&fc, vnode, dentry->d_name.name, true,
|
||||
|
@ -1374,7 +1374,7 @@ static int afs_unlink(struct inode *dir, struct dentry *dentry)
|
|||
spin_unlock(&dentry->d_lock);
|
||||
|
||||
ret = -ERESTARTSYS;
|
||||
if (afs_begin_vnode_operation(&fc, dvnode, key)) {
|
||||
if (afs_begin_vnode_operation(&fc, dvnode, key, true)) {
|
||||
while (afs_select_fileserver(&fc)) {
|
||||
fc.cb_break = afs_calc_vnode_cb_break(dvnode);
|
||||
|
||||
|
@ -1445,7 +1445,7 @@ static int afs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
|
|||
}
|
||||
|
||||
ret = -ERESTARTSYS;
|
||||
if (afs_begin_vnode_operation(&fc, dvnode, key)) {
|
||||
if (afs_begin_vnode_operation(&fc, dvnode, key, true)) {
|
||||
while (afs_select_fileserver(&fc)) {
|
||||
fc.cb_break = afs_calc_vnode_cb_break(dvnode);
|
||||
afs_fs_create(&fc, dentry->d_name.name, mode, data_version,
|
||||
|
@ -1510,7 +1510,7 @@ static int afs_link(struct dentry *from, struct inode *dir,
|
|||
}
|
||||
|
||||
ret = -ERESTARTSYS;
|
||||
if (afs_begin_vnode_operation(&fc, dvnode, key)) {
|
||||
if (afs_begin_vnode_operation(&fc, dvnode, key, true)) {
|
||||
if (mutex_lock_interruptible_nested(&vnode->io_lock, 1) < 0) {
|
||||
afs_end_vnode_operation(&fc);
|
||||
goto error_key;
|
||||
|
@ -1584,7 +1584,7 @@ static int afs_symlink(struct inode *dir, struct dentry *dentry,
|
|||
}
|
||||
|
||||
ret = -ERESTARTSYS;
|
||||
if (afs_begin_vnode_operation(&fc, dvnode, key)) {
|
||||
if (afs_begin_vnode_operation(&fc, dvnode, key, true)) {
|
||||
while (afs_select_fileserver(&fc)) {
|
||||
fc.cb_break = afs_calc_vnode_cb_break(dvnode);
|
||||
afs_fs_symlink(&fc, dentry->d_name.name,
|
||||
|
@ -1696,7 +1696,7 @@ static int afs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
|||
}
|
||||
|
||||
ret = -ERESTARTSYS;
|
||||
if (afs_begin_vnode_operation(&fc, orig_dvnode, key)) {
|
||||
if (afs_begin_vnode_operation(&fc, orig_dvnode, key, true)) {
|
||||
if (orig_dvnode != new_dvnode) {
|
||||
if (mutex_lock_interruptible_nested(&new_dvnode->io_lock, 1) < 0) {
|
||||
afs_end_vnode_operation(&fc);
|
||||
|
|
|
@ -30,7 +30,7 @@ static int afs_do_silly_rename(struct afs_vnode *dvnode, struct afs_vnode *vnode
|
|||
_enter("%pd,%pd", old, new);
|
||||
|
||||
trace_afs_silly_rename(vnode, false);
|
||||
if (afs_begin_vnode_operation(&fc, dvnode, key)) {
|
||||
if (afs_begin_vnode_operation(&fc, dvnode, key, true)) {
|
||||
while (afs_select_fileserver(&fc)) {
|
||||
fc.cb_break = afs_calc_vnode_cb_break(dvnode);
|
||||
afs_fs_rename(&fc, old->d_name.name,
|
||||
|
@ -149,7 +149,7 @@ static int afs_do_silly_unlink(struct afs_vnode *dvnode, struct afs_vnode *vnode
|
|||
_enter("");
|
||||
|
||||
trace_afs_silly_rename(vnode, true);
|
||||
if (afs_begin_vnode_operation(&fc, dvnode, key)) {
|
||||
if (afs_begin_vnode_operation(&fc, dvnode, key, false)) {
|
||||
while (afs_select_fileserver(&fc)) {
|
||||
fc.cb_break = afs_calc_vnode_cb_break(dvnode);
|
||||
|
||||
|
|
|
@ -238,7 +238,7 @@ int afs_fetch_data(struct afs_vnode *vnode, struct key *key, struct afs_read *de
|
|||
key_serial(key));
|
||||
|
||||
ret = -ERESTARTSYS;
|
||||
if (afs_begin_vnode_operation(&fc, vnode, key)) {
|
||||
if (afs_begin_vnode_operation(&fc, vnode, key, true)) {
|
||||
while (afs_select_fileserver(&fc)) {
|
||||
fc.cb_break = afs_calc_vnode_cb_break(vnode);
|
||||
afs_fs_fetch_data(&fc, desc);
|
||||
|
|
|
@ -196,7 +196,7 @@ static int afs_set_lock(struct afs_vnode *vnode, struct key *key,
|
|||
key_serial(key), type);
|
||||
|
||||
ret = -ERESTARTSYS;
|
||||
if (afs_begin_vnode_operation(&fc, vnode, key)) {
|
||||
if (afs_begin_vnode_operation(&fc, vnode, key, true)) {
|
||||
while (afs_select_fileserver(&fc)) {
|
||||
fc.cb_break = afs_calc_vnode_cb_break(vnode);
|
||||
afs_fs_set_lock(&fc, type);
|
||||
|
@ -227,7 +227,7 @@ static int afs_extend_lock(struct afs_vnode *vnode, struct key *key)
|
|||
key_serial(key));
|
||||
|
||||
ret = -ERESTARTSYS;
|
||||
if (afs_begin_vnode_operation(&fc, vnode, key)) {
|
||||
if (afs_begin_vnode_operation(&fc, vnode, key, false)) {
|
||||
while (afs_select_current_fileserver(&fc)) {
|
||||
fc.cb_break = afs_calc_vnode_cb_break(vnode);
|
||||
afs_fs_extend_lock(&fc);
|
||||
|
@ -258,7 +258,7 @@ static int afs_release_lock(struct afs_vnode *vnode, struct key *key)
|
|||
key_serial(key));
|
||||
|
||||
ret = -ERESTARTSYS;
|
||||
if (afs_begin_vnode_operation(&fc, vnode, key)) {
|
||||
if (afs_begin_vnode_operation(&fc, vnode, key, false)) {
|
||||
while (afs_select_current_fileserver(&fc)) {
|
||||
fc.cb_break = afs_calc_vnode_cb_break(vnode);
|
||||
afs_fs_release_lock(&fc);
|
||||
|
|
|
@ -469,6 +469,7 @@ int afs_fs_fetch_file_status(struct afs_fs_cursor *fc, struct afs_volsync *volsy
|
|||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_call(call, &vnode->fid);
|
||||
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
@ -664,6 +665,7 @@ static int afs_fs_fetch_data64(struct afs_fs_cursor *fc, struct afs_read *req)
|
|||
call->cb_break = fc->cb_break;
|
||||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_call(call, &vnode->fid);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
@ -712,6 +714,7 @@ int afs_fs_fetch_data(struct afs_fs_cursor *fc, struct afs_read *req)
|
|||
call->cb_break = fc->cb_break;
|
||||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_call(call, &vnode->fid);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
@ -833,6 +836,7 @@ int afs_fs_create(struct afs_fs_cursor *fc,
|
|||
|
||||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_call1(call, &vnode->fid, name);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
@ -930,6 +934,7 @@ int afs_fs_remove(struct afs_fs_cursor *fc, struct afs_vnode *vnode,
|
|||
|
||||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_call1(call, &dvnode->fid, name);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
@ -1023,6 +1028,7 @@ int afs_fs_link(struct afs_fs_cursor *fc, struct afs_vnode *vnode,
|
|||
|
||||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_call1(call, &vnode->fid, name);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
@ -1138,6 +1144,7 @@ int afs_fs_symlink(struct afs_fs_cursor *fc,
|
|||
|
||||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_call1(call, &vnode->fid, name);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
@ -1257,6 +1264,7 @@ int afs_fs_rename(struct afs_fs_cursor *fc,
|
|||
|
||||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_call2(call, &orig_dvnode->fid, orig_name, new_name);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
@ -1362,6 +1370,7 @@ static int afs_fs_store_data64(struct afs_fs_cursor *fc,
|
|||
*bp++ = htonl((u32) i_size);
|
||||
|
||||
trace_afs_make_fs_call(call, &vnode->fid);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
@ -1439,6 +1448,7 @@ int afs_fs_store_data(struct afs_fs_cursor *fc, struct address_space *mapping,
|
|||
|
||||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_call(call, &vnode->fid);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
@ -1538,6 +1548,7 @@ static int afs_fs_setattr_size64(struct afs_fs_cursor *fc, struct iattr *attr)
|
|||
|
||||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_call(call, &vnode->fid);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
@ -1585,6 +1596,7 @@ static int afs_fs_setattr_size(struct afs_fs_cursor *fc, struct iattr *attr)
|
|||
|
||||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_call(call, &vnode->fid);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
@ -1630,6 +1642,7 @@ int afs_fs_setattr(struct afs_fs_cursor *fc, struct iattr *attr)
|
|||
|
||||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_call(call, &vnode->fid);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
@ -1815,6 +1828,7 @@ int afs_fs_get_volume_status(struct afs_fs_cursor *fc,
|
|||
|
||||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_call(call, &vnode->fid);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
@ -1906,6 +1920,7 @@ int afs_fs_set_lock(struct afs_fs_cursor *fc, afs_lock_type_t type)
|
|||
|
||||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_calli(call, &vnode->fid, type);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
@ -1942,6 +1957,7 @@ int afs_fs_extend_lock(struct afs_fs_cursor *fc)
|
|||
|
||||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_call(call, &vnode->fid);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
@ -1977,6 +1993,7 @@ int afs_fs_release_lock(struct afs_fs_cursor *fc)
|
|||
|
||||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_call(call, &vnode->fid);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
@ -2211,6 +2228,7 @@ int afs_fs_fetch_status(struct afs_fs_cursor *fc,
|
|||
call->cb_break = fc->cb_break;
|
||||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_call(call, fid);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
@ -2397,6 +2415,7 @@ int afs_fs_inline_bulk_status(struct afs_fs_cursor *fc,
|
|||
call->cb_break = fc->cb_break;
|
||||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_call(call, &fids[0]);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
|
|
@ -136,7 +136,7 @@ int afs_fetch_status(struct afs_vnode *vnode, struct key *key, bool new_inode)
|
|||
vnode->flags);
|
||||
|
||||
ret = -ERESTARTSYS;
|
||||
if (afs_begin_vnode_operation(&fc, vnode, key)) {
|
||||
if (afs_begin_vnode_operation(&fc, vnode, key, true)) {
|
||||
while (afs_select_fileserver(&fc)) {
|
||||
fc.cb_break = afs_calc_vnode_cb_break(vnode);
|
||||
afs_fs_fetch_file_status(&fc, NULL, new_inode);
|
||||
|
@ -617,7 +617,7 @@ int afs_setattr(struct dentry *dentry, struct iattr *attr)
|
|||
}
|
||||
|
||||
ret = -ERESTARTSYS;
|
||||
if (afs_begin_vnode_operation(&fc, vnode, key)) {
|
||||
if (afs_begin_vnode_operation(&fc, vnode, key, false)) {
|
||||
while (afs_select_fileserver(&fc)) {
|
||||
fc.cb_break = afs_calc_vnode_cb_break(vnode);
|
||||
afs_fs_setattr(&fc, attr);
|
||||
|
|
|
@ -149,6 +149,7 @@ struct afs_call {
|
|||
bool ret_reply0; /* T if should return reply[0] on success */
|
||||
bool upgrade; /* T to request service upgrade */
|
||||
bool want_reply_time; /* T if want reply_time */
|
||||
bool intr; /* T if interruptible */
|
||||
u16 service_id; /* Actual service ID (after upgrade) */
|
||||
unsigned int debug_id; /* Trace ID */
|
||||
u32 operation_ID; /* operation ID for an incoming call */
|
||||
|
@ -773,6 +774,7 @@ struct afs_fs_cursor {
|
|||
#define AFS_FS_CURSOR_VNOVOL 0x0008 /* Set if seen VNOVOL */
|
||||
#define AFS_FS_CURSOR_CUR_ONLY 0x0010 /* Set if current server only (file lock held) */
|
||||
#define AFS_FS_CURSOR_NO_VSLEEP 0x0020 /* Set to prevent sleep on VBUSY, VOFFLINE, ... */
|
||||
#define AFS_FS_CURSOR_INTR 0x0040 /* Set if op is interruptible */
|
||||
unsigned short nr_iterations; /* Number of server iterations */
|
||||
};
|
||||
|
||||
|
@ -1097,7 +1099,7 @@ static inline void afs_put_sysnames(struct afs_sysnames *sysnames) {}
|
|||
* rotate.c
|
||||
*/
|
||||
extern bool afs_begin_vnode_operation(struct afs_fs_cursor *, struct afs_vnode *,
|
||||
struct key *);
|
||||
struct key *, bool);
|
||||
extern bool afs_select_fileserver(struct afs_fs_cursor *);
|
||||
extern bool afs_select_current_fileserver(struct afs_fs_cursor *);
|
||||
extern int afs_end_vnode_operation(struct afs_fs_cursor *);
|
||||
|
@ -1122,6 +1124,11 @@ extern void afs_send_simple_reply(struct afs_call *, const void *, size_t);
|
|||
extern int afs_extract_data(struct afs_call *, bool);
|
||||
extern int afs_protocol_error(struct afs_call *, int, enum afs_eproto_cause);
|
||||
|
||||
static inline void afs_set_fc_call(struct afs_call *call, struct afs_fs_cursor *fc)
|
||||
{
|
||||
call->intr = fc->flags & AFS_FS_CURSOR_INTR;
|
||||
}
|
||||
|
||||
static inline void afs_extract_begin(struct afs_call *call, void *buf, size_t size)
|
||||
{
|
||||
call->kvec[0].iov_base = buf;
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
* them here also using the io_lock.
|
||||
*/
|
||||
bool afs_begin_vnode_operation(struct afs_fs_cursor *fc, struct afs_vnode *vnode,
|
||||
struct key *key)
|
||||
struct key *key, bool intr)
|
||||
{
|
||||
memset(fc, 0, sizeof(*fc));
|
||||
fc->vnode = vnode;
|
||||
|
@ -33,10 +33,15 @@ bool afs_begin_vnode_operation(struct afs_fs_cursor *fc, struct afs_vnode *vnode
|
|||
fc->ac.error = SHRT_MAX;
|
||||
fc->error = -EDESTADDRREQ;
|
||||
|
||||
if (mutex_lock_interruptible(&vnode->io_lock) < 0) {
|
||||
fc->error = -EINTR;
|
||||
fc->flags |= AFS_FS_CURSOR_STOP;
|
||||
return false;
|
||||
if (intr) {
|
||||
fc->flags |= AFS_FS_CURSOR_INTR;
|
||||
if (mutex_lock_interruptible(&vnode->io_lock) < 0) {
|
||||
fc->error = -EINTR;
|
||||
fc->flags |= AFS_FS_CURSOR_STOP;
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
mutex_lock(&vnode->io_lock);
|
||||
}
|
||||
|
||||
if (vnode->lock_state != AFS_VNODE_LOCK_NONE)
|
||||
|
@ -118,10 +123,14 @@ static void afs_busy(struct afs_volume *volume, u32 abort_code)
|
|||
*/
|
||||
static bool afs_sleep_and_retry(struct afs_fs_cursor *fc)
|
||||
{
|
||||
msleep_interruptible(1000);
|
||||
if (signal_pending(current)) {
|
||||
fc->error = -ERESTARTSYS;
|
||||
return false;
|
||||
if (fc->flags & AFS_FS_CURSOR_INTR) {
|
||||
msleep_interruptible(1000);
|
||||
if (signal_pending(current)) {
|
||||
fc->error = -ERESTARTSYS;
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
msleep(1000);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -417,7 +417,7 @@ void afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call, gfp_t gfp)
|
|||
afs_wake_up_async_call :
|
||||
afs_wake_up_call_waiter),
|
||||
call->upgrade,
|
||||
true,
|
||||
call->intr,
|
||||
call->debug_id);
|
||||
if (IS_ERR(rxcall)) {
|
||||
ret = PTR_ERR(rxcall);
|
||||
|
@ -653,7 +653,7 @@ long afs_wait_for_call_to_complete(struct afs_call *call,
|
|||
break;
|
||||
}
|
||||
|
||||
if (timeout == 0 &&
|
||||
if (call->intr && timeout == 0 &&
|
||||
life == last_life && signal_pending(current)) {
|
||||
if (stalled)
|
||||
break;
|
||||
|
|
|
@ -521,6 +521,13 @@ static noinline bool afs_update_server_record(struct afs_fs_cursor *fc, struct a
|
|||
alist = afs_vl_lookup_addrs(fc->vnode->volume->cell, fc->key,
|
||||
&server->uuid);
|
||||
if (IS_ERR(alist)) {
|
||||
if ((PTR_ERR(alist) == -ERESTARTSYS ||
|
||||
PTR_ERR(alist) == -EINTR) &&
|
||||
!(fc->flags & AFS_FS_CURSOR_INTR) &&
|
||||
server->addresses) {
|
||||
_leave(" = t [intr]");
|
||||
return true;
|
||||
}
|
||||
fc->error = PTR_ERR(alist);
|
||||
_leave(" = f [%d]", fc->error);
|
||||
return false;
|
||||
|
@ -574,6 +581,10 @@ bool afs_check_server_record(struct afs_fs_cursor *fc, struct afs_server *server
|
|||
ret = wait_on_bit(&server->flags, AFS_SERVER_FL_UPDATING,
|
||||
TASK_INTERRUPTIBLE);
|
||||
if (ret == -ERESTARTSYS) {
|
||||
if (!(fc->flags & AFS_FS_CURSOR_INTR) && server->addresses) {
|
||||
_leave(" = t [intr]");
|
||||
return true;
|
||||
}
|
||||
fc->error = ret;
|
||||
_leave(" = f [intr]");
|
||||
return false;
|
||||
|
|
|
@ -741,7 +741,7 @@ static int afs_statfs(struct dentry *dentry, struct kstatfs *buf)
|
|||
return PTR_ERR(key);
|
||||
|
||||
ret = -ERESTARTSYS;
|
||||
if (afs_begin_vnode_operation(&fc, vnode, key)) {
|
||||
if (afs_begin_vnode_operation(&fc, vnode, key, true)) {
|
||||
fc.flags |= AFS_FS_CURSOR_NO_VSLEEP;
|
||||
while (afs_select_fileserver(&fc)) {
|
||||
fc.cb_break = afs_calc_vnode_cb_break(vnode);
|
||||
|
|
|
@ -361,7 +361,7 @@ static int afs_store_data(struct address_space *mapping,
|
|||
_debug("USE WB KEY %u", key_serial(wbk->key));
|
||||
|
||||
ret = -ERESTARTSYS;
|
||||
if (afs_begin_vnode_operation(&fc, vnode, wbk->key)) {
|
||||
if (afs_begin_vnode_operation(&fc, vnode, wbk->key, false)) {
|
||||
while (afs_select_fileserver(&fc)) {
|
||||
fc.cb_break = afs_calc_vnode_cb_break(vnode);
|
||||
afs_fs_store_data(&fc, mapping, first, last, offset, to);
|
||||
|
|
|
@ -57,7 +57,7 @@ static int afs_xattr_get_acl(const struct xattr_handler *handler,
|
|||
return PTR_ERR(key);
|
||||
|
||||
ret = -ERESTARTSYS;
|
||||
if (afs_begin_vnode_operation(&fc, vnode, key)) {
|
||||
if (afs_begin_vnode_operation(&fc, vnode, key, true)) {
|
||||
while (afs_select_fileserver(&fc)) {
|
||||
fc.cb_break = afs_calc_vnode_cb_break(vnode);
|
||||
acl = afs_fs_fetch_acl(&fc);
|
||||
|
@ -114,7 +114,7 @@ static int afs_xattr_set_acl(const struct xattr_handler *handler,
|
|||
memcpy(acl->data, buffer, size);
|
||||
|
||||
ret = -ERESTARTSYS;
|
||||
if (afs_begin_vnode_operation(&fc, vnode, key)) {
|
||||
if (afs_begin_vnode_operation(&fc, vnode, key, true)) {
|
||||
while (afs_select_fileserver(&fc)) {
|
||||
fc.cb_break = afs_calc_vnode_cb_break(vnode);
|
||||
afs_fs_store_acl(&fc, acl);
|
||||
|
@ -178,7 +178,7 @@ static int afs_xattr_get_yfs(const struct xattr_handler *handler,
|
|||
}
|
||||
|
||||
ret = -ERESTARTSYS;
|
||||
if (afs_begin_vnode_operation(&fc, vnode, key)) {
|
||||
if (afs_begin_vnode_operation(&fc, vnode, key, true)) {
|
||||
while (afs_select_fileserver(&fc)) {
|
||||
fc.cb_break = afs_calc_vnode_cb_break(vnode);
|
||||
yfs_fs_fetch_opaque_acl(&fc, yacl);
|
||||
|
@ -263,7 +263,7 @@ static int afs_xattr_set_yfs(const struct xattr_handler *handler,
|
|||
memcpy(acl->data, buffer, size);
|
||||
|
||||
ret = -ERESTARTSYS;
|
||||
if (afs_begin_vnode_operation(&fc, vnode, key)) {
|
||||
if (afs_begin_vnode_operation(&fc, vnode, key, true)) {
|
||||
while (afs_select_fileserver(&fc)) {
|
||||
fc.cb_break = afs_calc_vnode_cb_break(vnode);
|
||||
yfs_fs_store_opaque_acl2(&fc, acl);
|
||||
|
|
|
@ -519,6 +519,7 @@ int yfs_fs_fetch_file_status(struct afs_fs_cursor *fc, struct afs_volsync *volsy
|
|||
call->cb_break = fc->cb_break;
|
||||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_call(call, &vnode->fid);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
@ -712,6 +713,7 @@ int yfs_fs_fetch_data(struct afs_fs_cursor *fc, struct afs_read *req)
|
|||
call->cb_break = fc->cb_break;
|
||||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_call(call, &vnode->fid);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
@ -813,6 +815,7 @@ int yfs_fs_create_file(struct afs_fs_cursor *fc,
|
|||
|
||||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_call1(call, &vnode->fid, name);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
@ -877,6 +880,7 @@ int yfs_fs_make_dir(struct afs_fs_cursor *fc,
|
|||
|
||||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_call1(call, &vnode->fid, name);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
@ -968,6 +972,7 @@ int yfs_fs_remove_file2(struct afs_fs_cursor *fc, struct afs_vnode *vnode,
|
|||
|
||||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_call1(call, &dvnode->fid, name);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
@ -1056,6 +1061,7 @@ int yfs_fs_remove(struct afs_fs_cursor *fc, struct afs_vnode *vnode,
|
|||
|
||||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_call1(call, &dvnode->fid, name);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
@ -1142,6 +1148,7 @@ int yfs_fs_link(struct afs_fs_cursor *fc, struct afs_vnode *vnode,
|
|||
|
||||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_call1(call, &vnode->fid, name);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
@ -1239,6 +1246,7 @@ int yfs_fs_symlink(struct afs_fs_cursor *fc,
|
|||
|
||||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_call1(call, &dvnode->fid, name);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
@ -1338,6 +1346,7 @@ int yfs_fs_rename(struct afs_fs_cursor *fc,
|
|||
|
||||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_call2(call, &orig_dvnode->fid, orig_name, new_name);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
@ -1445,6 +1454,7 @@ int yfs_fs_store_data(struct afs_fs_cursor *fc, struct address_space *mapping,
|
|||
|
||||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_call(call, &vnode->fid);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
@ -1534,6 +1544,7 @@ static int yfs_fs_setattr_size(struct afs_fs_cursor *fc, struct iattr *attr)
|
|||
|
||||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_call(call, &vnode->fid);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
@ -1578,6 +1589,7 @@ int yfs_fs_setattr(struct afs_fs_cursor *fc, struct iattr *attr)
|
|||
|
||||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_call(call, &vnode->fid);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
@ -1767,6 +1779,7 @@ int yfs_fs_get_volume_status(struct afs_fs_cursor *fc,
|
|||
|
||||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_call(call, &vnode->fid);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
@ -1866,6 +1879,7 @@ int yfs_fs_set_lock(struct afs_fs_cursor *fc, afs_lock_type_t type)
|
|||
|
||||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_calli(call, &vnode->fid, type);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
@ -1903,6 +1917,7 @@ int yfs_fs_extend_lock(struct afs_fs_cursor *fc)
|
|||
|
||||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_call(call, &vnode->fid);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
@ -1939,6 +1954,7 @@ int yfs_fs_release_lock(struct afs_fs_cursor *fc)
|
|||
|
||||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_call(call, &vnode->fid);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
@ -2028,6 +2044,7 @@ int yfs_fs_fetch_status(struct afs_fs_cursor *fc,
|
|||
call->cb_break = fc->cb_break;
|
||||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_call(call, fid);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
@ -2212,6 +2229,7 @@ int yfs_fs_inline_bulk_status(struct afs_fs_cursor *fc,
|
|||
call->cb_break = fc->cb_break;
|
||||
afs_use_fs_server(call, fc->cbi);
|
||||
trace_afs_make_fs_call(call, &fids[0]);
|
||||
afs_set_fc_call(call, fc);
|
||||
afs_make_call(&fc->ac, call, GFP_NOFS);
|
||||
return afs_wait_for_call_to_complete(call, &fc->ac);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user