mirror of
https://git.openafs.org/openafs.git
synced 2025-01-19 15:30:14 +00:00
Atomically collect callbacks to be broken
Collect callbacks to be broken in one go, otherwise a file server may lock out a client while new callbacks tickle in. With revised multi_Rx, responses get handled early, taking away an argument for issuing callbacks in small chunks -> crank up chunk size. Change-Id: I6822256715d1388aa1a44049315813ea08009105 Reviewed-on: http://gerrit.openafs.org/3909 Reviewed-by: Derrick Brashear <shadow@dementia.org> Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
This commit is contained in:
parent
2386f5741d
commit
843d705ca6
@ -799,8 +799,8 @@ BreakCallBack(struct host *xhost, AFSFid * fid, int flag)
|
|||||||
{
|
{
|
||||||
struct FileEntry *fe;
|
struct FileEntry *fe;
|
||||||
struct CallBack *cb, *nextcb;
|
struct CallBack *cb, *nextcb;
|
||||||
struct cbstruct cba[MAX_CB_HOSTS];
|
struct cbstruct cbaDef[MAX_CB_HOSTS], *cba = cbaDef;
|
||||||
int ncbas;
|
unsigned int ncbas, cbaAlloc = MAX_CB_HOSTS;
|
||||||
struct AFSCBFids tf;
|
struct AFSCBFids tf;
|
||||||
int hostindex;
|
int hostindex;
|
||||||
char hoststr[16];
|
char hoststr[16];
|
||||||
@ -825,8 +825,7 @@ BreakCallBack(struct host *xhost, AFSFid * fid, int flag)
|
|||||||
tf.AFSCBFids_len = 1;
|
tf.AFSCBFids_len = 1;
|
||||||
tf.AFSCBFids_val = fid;
|
tf.AFSCBFids_val = fid;
|
||||||
|
|
||||||
for (; cb;) {
|
for (ncbas = 0; cb ; cb = nextcb) {
|
||||||
for (ncbas = 0; cb && ncbas < MAX_CB_HOSTS; cb = nextcb) {
|
|
||||||
nextcb = itocb(cb->cnext);
|
nextcb = itocb(cb->cnext);
|
||||||
if ((cb->hhead != hostindex || flag)
|
if ((cb->hhead != hostindex || flag)
|
||||||
&& (cb->status == CB_BULK || cb->status == CB_NORMAL
|
&& (cb->status == CB_BULK || cb->status == CB_NORMAL
|
||||||
@ -843,6 +842,21 @@ BreakCallBack(struct host *xhost, AFSFid * fid, int flag)
|
|||||||
} else {
|
} else {
|
||||||
if (!(thishost->hostFlags & HOSTDELETED)) {
|
if (!(thishost->hostFlags & HOSTDELETED)) {
|
||||||
h_Hold_r(thishost);
|
h_Hold_r(thishost);
|
||||||
|
if (ncbas == cbaAlloc) { /* Need more space */
|
||||||
|
int curLen = cbaAlloc*sizeof(cba[0]);
|
||||||
|
struct cbstruct *cbaOld = (cba == cbaDef) ? NULL : cba;
|
||||||
|
|
||||||
|
/* There are logical contraints elsewhere that the number of hosts
|
||||||
|
(i.e. h_HTSPERBLOCK*h_MAXHOSTTABLES) remains in the realm of a signed "int".
|
||||||
|
cbaAlloc is defined unsigned int hence doubling below cannot overflow
|
||||||
|
*/
|
||||||
|
cbaAlloc = cbaAlloc<<1; /* double */
|
||||||
|
cba = realloc(cbaOld, cbaAlloc * sizeof(cba[0]));
|
||||||
|
|
||||||
|
if (cbaOld == NULL) { /* realloc wouldn't have copied from cbaDef */
|
||||||
|
memcpy(cba, cbaDef, curLen);
|
||||||
|
}
|
||||||
|
}
|
||||||
cba[ncbas].hp = thishost;
|
cba[ncbas].hp = thishost;
|
||||||
cba[ncbas].thead = cb->thead;
|
cba[ncbas].thead = cb->thead;
|
||||||
ncbas++;
|
ncbas++;
|
||||||
@ -856,20 +870,16 @@ BreakCallBack(struct host *xhost, AFSFid * fid, int flag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ncbas) {
|
if (ncbas) {
|
||||||
MultiBreakCallBack_r(cba, ncbas, &tf, xhost);
|
struct cbstruct *cba2;
|
||||||
|
int num;
|
||||||
|
|
||||||
/* we need to to all these initializations again because MultiBreakCallBack may block */
|
for (cba2 = cba, num = ncbas; ncbas > 0; cba2 += num, ncbas -= num) {
|
||||||
fe = FindFE(fid);
|
num = (ncbas > MAX_CB_HOSTS) ? MAX_CB_HOSTS : ncbas;
|
||||||
if (!fe) {
|
MultiBreakCallBack_r(cba2, num, &tf, xhost);
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
cb = itocb(fe->firstcb);
|
|
||||||
if (!cb || ((fe->ncbs == 1) && (cb->hhead == hostindex) && !flag)) {
|
|
||||||
/* the most common case is what follows the || */
|
|
||||||
goto done;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (cba != cbaDef) free(cba);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
H_UNLOCK;
|
H_UNLOCK;
|
||||||
|
@ -19,7 +19,8 @@
|
|||||||
* thereby swamping the file server. As a result, something like
|
* thereby swamping the file server. As a result, something like
|
||||||
* 10 or 15 might be a better bet.
|
* 10 or 15 might be a better bet.
|
||||||
*/
|
*/
|
||||||
#define MAX_CB_HOSTS 10
|
/* With revised multi_Rx, responses get handled as early as they tickle in, so try big */
|
||||||
|
#define MAX_CB_HOSTS 1024
|
||||||
|
|
||||||
/* max time to break a callback, otherwise client is dead or net is hosed */
|
/* max time to break a callback, otherwise client is dead or net is hosed */
|
||||||
#define MAXCBT 25
|
#define MAXCBT 25
|
||||||
|
Loading…
Reference in New Issue
Block a user