Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
garlick committed Mar 18, 2010
1 parent 5c93377 commit e68fe79
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 29 deletions.
7 changes: 7 additions & 0 deletions README
Expand Up @@ -16,3 +16,10 @@ TODO
- diodmount should umount control file system when it aborts for other reasons
- init scripts 'restart' fails to start server if it is not already running
- init scripts should create rundir if it doesn't exist
- handle lustre ioctls?
error on ioctl 0x4008669a
for '/p/lcrater2/garlick/ior-fpp.1000010/testfile.00000000' (3):
Inappropriate ioctl for device
error: setstripe: create stripe file
'/p/lcrater2/garlick/ior-fpp.1000010/testfile.00000000' failed

2 changes: 2 additions & 0 deletions common/diod_conf.c
Expand Up @@ -458,6 +458,7 @@ diod_conf_validate_exports (void)
list_iterator_destroy (itr);
}

#ifdef HAVE_LUA_H
static int
_lua_getglobal_int (char *path, lua_State *L, char *key, int *ip)
{
Expand Down Expand Up @@ -598,6 +599,7 @@ diod_conf_init_config_file (char *path)
lua_close(L);
}
}
#endif /* HAVE_LUA_H */

/*
* vi:tabstop=4 shiftwidth=4 expandtab
Expand Down
10 changes: 4 additions & 6 deletions common/diod_sock.c
Expand Up @@ -263,7 +263,7 @@ _accept_one (Npsrv *srv, int fd, int wrap)
}

/* Loop accepting and handling new 9P connections.
* Both diod and diodctl use this.
* This comprises the main service loop in diod and diodctl daemons.
*/
void
diod_sock_accept_loop (Npsrv *srv, struct pollfd *fds, int nfds, int wrap)
Expand Down Expand Up @@ -329,6 +329,7 @@ _connect_one (char *host, char *port)

/* Try to connect to any members of host:port list.
* If nport is non-NULL, substitute that for :port.
* Make maxtries attempts, waiting retry_wait_ms milliseconds between attempts.
* Return 1 on success, 0 on failure.
*/
int
Expand All @@ -347,7 +348,7 @@ diod_sock_tryconnect (List l, char *nport, int maxtries, int retry_wait_ms)
usleep (1000 * retry_wait_ms);
list_iterator_reset (itr);
}
while ((hostport = list_next(itr))) {
while (res == 0 && (hostport = list_next(itr))) {
if (!(host = strdup (hostport))) {
msg ("out of memory");
goto done;
Expand All @@ -357,10 +358,7 @@ diod_sock_tryconnect (List l, char *nport, int maxtries, int retry_wait_ms)
*port++ = '\0';
if (nport)
port = nport;
if ((res = _connect_one (host, port))) {
free (host);
goto done;
}
res = _connect_one (host, port);
free (host);
}
}
Expand Down
2 changes: 1 addition & 1 deletion common/diod_upool.c
Expand Up @@ -24,7 +24,7 @@
/* diod_upool.c - user lookup for diod distributed I/O daemon */

/* This upool implementation does no caching of /etc/passwd and /etc/group.
* Instead it creates Npusers and Mpgroups anew at attach time, shares them
* Instead it creates Npusers and Npgroups anew at attach time, shares them
* among cloned fids, and deletes them when the refcount goes to zero
* (e.g. when root is clunked at umount time). A users supplementary groups
* are not stored in Npuser->groups; instead supplementary groups are stored
Expand Down
7 changes: 5 additions & 2 deletions diod/diod.c
Expand Up @@ -177,10 +177,13 @@ main(int argc, char **argv)
usage();
if (lopt && Fopt)
msg_exit ("--listen-fds and --listen are mutually exclusive options");

#if HAVE_LUA_H
/* config file overrides defaults */
diod_conf_init_config_file (copt);

#else
if (copt)
msg_exit ("No lua support, yet --config-file was specified");
#endif
/* command line overrides config file */
if (fopt)
diod_conf_set_foreground (1);
Expand Down
6 changes: 5 additions & 1 deletion diodctl/diodctl.c
Expand Up @@ -174,9 +174,13 @@ main(int argc, char **argv)
}
if (optind < argc)
usage();

#if HAVE_LUA_H
/* config file overrides defaults */
diod_conf_init_config_file (copt);
#else
if (copt)
msg_exit ("No lua support, yet --config-file was specified");
#endif

/* command line overrides config file */
if (fopt)
Expand Down
69 changes: 50 additions & 19 deletions test/README
@@ -1,29 +1,60 @@
What do these tests show?

t00 - Show that pthreads can independently setfsuid/setfsgid.
This is a strategy for handling the I/O of multiple users in
threaded work crew.
t00-pthreads-setfsuid
Show that pthreads can independently setfsuid/setfsgid.
This is a strategy for handling the I/O of multiple users in
threaded work crew.

t01 - Show that supplementary groups work as advertised when
setfsuid/setfsgid being used.
t01-setfsuid-setgroups
Show that supplementary groups work as advertised when
setfsuid/setfsgid being used.

t02 - Check that pthreads can independently setgroups.
This is a strategy for handling the I/O of multiple users in
a threaded work crew.
t02-pthreads-setgroups
Check that pthreads can independently setgroups.
This is a strategy for handling the I/O of multiple users in
a threaded work crew.

t03 - Demonstrate that pthreads cannot independently seteuid/setegid.
This was the original npfs strategy for handing I/O of multiple
users in a threaded work crew. Not valid post-linuxthreads.
t03-pthreads-seteuid
Demonstrate that pthreads cannot independently seteuid/setegid.
This was the original npfs strategy for handing I/O of multiple
users in a threaded work crew. Not valid post-linuxthreads.

t04 - Demonstrate that fcntl advisory locking does not treat threads
like individual procesess, e.g. locks are shared among threads.
This means a threaded work crew cannot manage fcntl locks on behalf
of multiple remote processes.
t04-pthreads-fcntl
Demonstrate that fcntl advisory locking does not treat threads
like individual procesess, e.g. locks are shared among threads.
This means a threaded work crew cannot manage fcntl locks on behalf
of multiple remote processes.

t05 - Simple mount/unmount sanity test for diod
t05-mount-sanity
Simple mount/unmount sanity test for diod (default options).

t06 - Simple mount/read/unmount sanity test for diod
t06-read-sanity
Simple mount/read/unmount sanity test for diod

t07 - Simple mount/write/unmount sanity test for diod
t07-write-sanity
Simple mount/write/unmount sanity test for diod

t08-option-parse
Unit test for diodmount option handling module.

t09-mount-9P2000
Simple mount/unmount sanity test for legacy protocol.

t10-mount-9P2000.u
Simple mount/unmount sanity test for 9P2000.u protocol.

t11-mount-9P2000.L
Simple mount/unmount sanity test for 9P2000.L protocol.

t12-mount-9P2000.H
Simple mount/unmount sanity test for 9P2000.H protocol.

t13-rename-across-dirs
Demonstrate that 9P2000.L rename works across directories.

t14-statfs
Demonstrate that 9P2000.L statfs returns correct data.

t15-fsync
Demonstrate that 9P2000.u fsync does not return an error.

t08 - Unit test for diodmount option handling module.

0 comments on commit e68fe79

Please sign in to comment.