cluster/group/gfs_controld lock_dlm.h main.c p ...
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: teigland at sourceware.org 2006-11-21 17:28:09
Modified files:
group/gfs_controld: lock_dlm.h main.c plock.c
Log message:
handle errors or short reads when reading /dev/misc/lock_dlm_plock
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/lock_dlm.h.diff?cvsroot=cluster&r1=1.22&r2=1.23
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/main.c.diff?cvsroot=cluster&r1=1.21&r2=1.22
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/plock.c.diff?cvsroot=cluster&r1=1.29&r2=1.30
group/gfs_controld/lock_dlm.h +1 -0
@@ -253,6 +253,7 @@char buf[0 ]; }; +int do_read (int fd,void *buf,size_t count);int do_write (int fd,void *buf,size_t count);struct mountgroup *find_mg (char *name);struct mountgroup *find_mg_id (uint32_t id);
group/gfs_controld/main.c +17 -1
@@ -42,6 +42,22 @@int no_plock;uint32_t plock_rate_limit =DEFAULT_PLOCK_RATE_LIMIT ; +int do_read (int fd,void *buf,size_t count) +{ +int rv, off =0 ; + +while (off < count) { + rv =read (fd, buf + off, count - off); +if (rv ==0 ) +return -1 ; +if (rv ==-1 && errno ==EINTR ) +continue ; +if (rv ==-1 ) +return -1 ; + off += rv; + } +return 0 ; +}int do_write (int fd,void *buf,size_t count) {
@@ -597,7 +613,7 @@printf (" -P Enable plock debugging\n" );printf (" -p Disable plocks\n" );printf (" -l <limit> Limit the rate of plock operations\n" ); -printf (" Default is %d, set to 0 for no limit\n" ,DEFAULT_PLOCK_RATE_LIMIT ); +printf (" Default is %d, set to 0 for no limit\n" ,DEFAULT_PLOCK_RATE_LIMIT );printf (" -w Disable withdraw\n" );printf (" -h Print this help, then exit\n" );printf (" -V Print program version information, then exit\n" );
group/gfs_controld/plock.c +6 -1
@@ -350,7 +350,12 @@memset (&info,0 ,sizeof (info)); - rv =read (control_fd, &info,sizeof (info)); + rv =do_read (control_fd, &info,sizeof (info)); +if (rv <0 ) { +log_debug ("process_plocks: read error %d fd %d\n" , + errno, control_fd); +return 0 ; + }if (!plocks_online) { rv = -ENOSYS ;