Removed the new_vnode() timeout for busy vnodes.

Fixed the op-description send_notification() gives - notify_listener() now
only prints out the op value, since it will call send_notification() anyway.
The tracker doesn't try to query files on B_ATTR_CHANGED or when node == 0,
or name == NULL.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3560 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2003-06-18 00:01:12 +00:00
parent 55288b8eda
commit 274e6fefaa
2 changed files with 30 additions and 23 deletions
@@ -988,9 +988,12 @@ static void
tracker_query_file(dev_t device, ino_t parent, char *name) tracker_query_file(dev_t device, ino_t parent, char *name)
{ {
struct stat stat; struct stat stat;
int status; int status, fd;
int fd = sys_open_entry_ref(1, device, parent, name, O_RDONLY, 0); if (name == NULL || parent == 0)
return;
fd = sys_open_entry_ref(1, device, parent, name, O_RDONLY, 0);
if (fd < 0) { if (fd < 0) {
printf("tracker: could not open file: %s\n", name); printf("tracker: could not open file: %s\n", name);
return; return;
@@ -1026,7 +1029,8 @@ tracker_loop(void *data)
if (code == FSH_NOTIFY_LISTENER) { if (code == FSH_NOTIFY_LISTENER) {
printf("tracker: notify listener received\n"); printf("tracker: notify listener received\n");
tracker_query_file(message.device, message.parentNode, message.name); if (message.op != B_ATTR_CHANGED && message.op != B_DEVICE_UNMOUNTED)
tracker_query_file(message.device, message.parentNode, message.name);
} else if (code == B_QUERY_UPDATE) { } else if (code == B_QUERY_UPDATE) {
printf("tracker: query update received\n"); printf("tracker: query update received\n");
tracker_query_file(message.device, message.parentNode, message.name); tracker_query_file(message.device, message.parentNode, message.name);
@@ -2307,7 +2307,7 @@ put_vnode(nspace_id nsid, vnode_id vnid)
int int
new_vnode(nspace_id nsid, vnode_id vnid, void *data) new_vnode(nspace_id nsid, vnode_id vnid, void *data)
{ {
int retries = 20; // int retries = 20;
vnode *vn; vnode *vn;
int err; int err;
@@ -2321,11 +2321,14 @@ restart:
if (vn->busy) { if (vn->busy) {
printf("new_vnode(): vnode exists and is busy!\n"); printf("new_vnode(): vnode exists and is busy!\n");
snooze(500); UNLOCK(vnlock);
if (retries-- >= 0) snooze(5000);
LOCK(vnlock);
// if (retries-- >= 0)
goto restart; goto restart;
printf("new_vnode(): still busy, but continue to our doom!\n"); // printf("new_vnode(): still busy, but continue to our doom!\n");
} }
if (vn->data != data) if (vn->data != data)
@@ -3243,6 +3246,21 @@ free_fds(fdarray *fds)
int int
notify_listener(int op, nspace_id nsid, vnode_id vnida, vnode_id vnidb, vnode_id vnidc, const char *name) notify_listener(int op, nspace_id nsid, vnode_id vnida, vnode_id vnidb, vnode_id vnidc, const char *name)
{ {
#ifdef DEBUG
printf("notify_listener: op = %ld\n", op);
#endif
return send_notification(0, 0, FSH_NOTIFY_LISTENER, op, nsid, -1, vnida, vnidb, vnidc, name);
}
int
send_notification(port_id port, long token, ulong what, long op, nspace_id nsida,
nspace_id nsidb, vnode_id vnida, vnode_id vnidb, vnode_id vnidc,
const char *name)
{
update_message message;
#ifdef DEBUG #ifdef DEBUG
char *text; char *text;
@@ -3272,23 +3290,8 @@ notify_listener(int op, nspace_id nsid, vnode_id vnida, vnode_id vnidb, vnode_id
text = "unknown operation..."; text = "unknown operation...";
break; break;
} }
printf("notify_listener: %s\n", text);
#endif
return send_notification(0, 0, FSH_NOTIFY_LISTENER, op, nsid, -1, vnida, vnidb, vnidc, name);
}
int
send_notification(port_id port, long token, ulong what, long op, nspace_id nsida,
nspace_id nsidb, vnode_id vnida, vnode_id vnidb, vnode_id vnidc,
const char *name)
{
update_message message;
#ifdef DEBUG
printf("send_notification... op = %s, name = %s, port = %ld, token = %ld\n", printf("send_notification... op = %s, name = %s, port = %ld, token = %ld\n",
op == B_ENTRY_CREATED ? "B_ENTRY_CREATED" : "B_ENTRY_REMOVED", name, port, token); text, name, port, token);
#endif #endif
message.op = op; message.op = op;