Re: [Cluster-devel] [PATCH] gfs2-utils: Remove unused exported functions

2012-07-04 Thread Steven Whitehouse
Hi,

ACK,

Steve.

On Wed, 2012-07-04 at 16:30 +0100, Andrew Price wrote:
> These symbols are now unused within the gfs2-utils tree:
> 
> $ findunused.sh | grep -v '^group/'
> gfs2/libgfs2/libgfs2.h:712find_debugfs_mount
> gfs2/libgfs2/misc.c:314   find_debugfs_mount
> gfs2/libgfs2/libgfs2.h:395gfs2_bitcount
> gfs2/libgfs2/fs_bits.c:109gfs2_bitcount
> gfs2/libgfs2/libgfs2.h:835gfs2_dirent_print
> gfs2/libgfs2/ondisk.c:418 gfs2_dirent_print
> gfs2/libgfs2/libgfs2.h:810gfs2_ea_header_out
> gfs2/libgfs2/ondisk.c:481 gfs2_ea_header_out
> gfs2/libgfs2/fs_ops.c:1371init_gfs_dinode
> gfs2/libgfs2/libgfs2.h:451init_gfs_dinode
> gfs2/libgfs2/libgfs2.h:713mp2fsname
> gfs2/libgfs2/misc.c:365   mp2fsname
> gfs2/libgfs2/libgfs2.h:705get_sysfs
> gfs2/libgfs2/misc.c:273   get_sysfs
> 
> So it's safe to remove them. The idea is to simplify libgfs2 for now but
> if these are required in future they can be brought back.
> 
> Signed-off-by: Andrew Price 
> ---
>  gfs2/libgfs2/fs_bits.c |   32 -
>  gfs2/libgfs2/fs_ops.c  |8 
>  gfs2/libgfs2/libgfs2.h |   12 -
>  gfs2/libgfs2/misc.c|  124 
> 
>  gfs2/libgfs2/ondisk.c  |   28 ---
>  5 files changed, 204 deletions(-)
> 
> diff --git a/gfs2/libgfs2/fs_bits.c b/gfs2/libgfs2/fs_bits.c
> index d3ac048..5eeb920 100644
> --- a/gfs2/libgfs2/fs_bits.c
> +++ b/gfs2/libgfs2/fs_bits.c
> @@ -98,38 +98,6 @@ unsigned long gfs2_bitfit(const unsigned char *buf, const 
> unsigned int len,
>   return (((const unsigned char *)ptr - buf) * GFS2_NBBY) + bit;
>  }
>  
> -/**
> - * fs_bitcount - count the number of bits in a certain state
> - * @buffer: the buffer that holds the bitmaps
> - * @buflen: the length (in bytes) of the buffer
> - * @state: the state of the block we're looking for
> - *
> - * Returns: The number of bits
> - */
> -uint32_t gfs2_bitcount(unsigned char *buffer, unsigned int buflen,
> -unsigned char state)
> -{
> - unsigned char *byte, *end;
> - unsigned int bit;
> - uint32_t count = 0;
> -
> - byte = buffer;
> - bit = 0;
> - end = buffer + buflen;
> -
> - while (byte < end){
> - if (((*byte >> bit) & GFS2_BIT_MASK) == state)
> - count++;
> -
> - bit += GFS2_BIT_SIZE;
> - if (bit >= 8){
> - bit = 0;
> - byte++;
> - }
> - }
> - return count;
> -}
> -
>  /*
>   * check_range - check if blkno is within FS limits
>   * @sdp: super block
> diff --git a/gfs2/libgfs2/fs_ops.c b/gfs2/libgfs2/fs_ops.c
> index 470916c..9409332 100644
> --- a/gfs2/libgfs2/fs_ops.c
> +++ b/gfs2/libgfs2/fs_ops.c
> @@ -1368,14 +1368,6 @@ struct gfs2_buffer_head *init_dinode(struct gfs2_sbd 
> *sdp,
>   return __init_dinode(sdp, inum, mode, flags, parent, 0);
>  }
>  
> -struct gfs2_buffer_head *init_gfs_dinode(struct gfs2_sbd *sdp,
> -  struct gfs2_inum *inum,
> -  unsigned int mode, uint32_t flags,
> -  struct gfs2_inum *parent)
> -{
> - return __init_dinode(sdp, inum, mode, flags, parent, 1);
> -}
> -
>  static struct gfs2_inode *__createi(struct gfs2_inode *dip,
>   const char *filename, unsigned int mode,
>   uint32_t flags, int if_gfs1)
> diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
> index 2fc47de..09f0b1d 100644
> --- a/gfs2/libgfs2/libgfs2.h
> +++ b/gfs2/libgfs2/libgfs2.h
> @@ -392,8 +392,6 @@ extern void fix_device_geometry(struct gfs2_sbd *sdp);
>  #define BFITNOENT (0x)
>  
>  /* functions with blk #'s that are buffer relative */
> -extern uint32_t gfs2_bitcount(unsigned char *buffer, unsigned int buflen,
> -   unsigned char state);
>  extern unsigned long gfs2_bitfit(const unsigned char *buffer,
>const unsigned int buflen,
>unsigned long goal, unsigned char old_state);
> @@ -448,11 +446,6 @@ extern struct gfs2_buffer_head *init_dinode(struct 
> gfs2_sbd *sdp,
>   struct gfs2_inum *inum,
>   unsigned int mode, uint32_t flags,
>   struct gfs2_inum *parent);
> -extern struct gfs2_buffer_head *init_gfs_dinode(struct gfs2_sbd *sdp,
> - struct gfs2_inum *inum,
> - unsigned int mode,
> - uint32_t flags,
> - struct gfs2_inum *parent);
>  extern struct gfs2_inode *createi(struct gfs2_inode *dip, const char 
> *filename,
> unsigned int mode, 

[Cluster-devel] [PATCH] gfs2-utils: Remove unused exported functions

2012-07-04 Thread Andrew Price
These symbols are now unused within the gfs2-utils tree:

$ findunused.sh | grep -v '^group/'
gfs2/libgfs2/libgfs2.h:712find_debugfs_mount
gfs2/libgfs2/misc.c:314   find_debugfs_mount
gfs2/libgfs2/libgfs2.h:395gfs2_bitcount
gfs2/libgfs2/fs_bits.c:109gfs2_bitcount
gfs2/libgfs2/libgfs2.h:835gfs2_dirent_print
gfs2/libgfs2/ondisk.c:418 gfs2_dirent_print
gfs2/libgfs2/libgfs2.h:810gfs2_ea_header_out
gfs2/libgfs2/ondisk.c:481 gfs2_ea_header_out
gfs2/libgfs2/fs_ops.c:1371init_gfs_dinode
gfs2/libgfs2/libgfs2.h:451init_gfs_dinode
gfs2/libgfs2/libgfs2.h:713mp2fsname
gfs2/libgfs2/misc.c:365   mp2fsname
gfs2/libgfs2/libgfs2.h:705get_sysfs
gfs2/libgfs2/misc.c:273   get_sysfs

So it's safe to remove them. The idea is to simplify libgfs2 for now but
if these are required in future they can be brought back.

Signed-off-by: Andrew Price 
---
 gfs2/libgfs2/fs_bits.c |   32 -
 gfs2/libgfs2/fs_ops.c  |8 
 gfs2/libgfs2/libgfs2.h |   12 -
 gfs2/libgfs2/misc.c|  124 
 gfs2/libgfs2/ondisk.c  |   28 ---
 5 files changed, 204 deletions(-)

diff --git a/gfs2/libgfs2/fs_bits.c b/gfs2/libgfs2/fs_bits.c
index d3ac048..5eeb920 100644
--- a/gfs2/libgfs2/fs_bits.c
+++ b/gfs2/libgfs2/fs_bits.c
@@ -98,38 +98,6 @@ unsigned long gfs2_bitfit(const unsigned char *buf, const 
unsigned int len,
return (((const unsigned char *)ptr - buf) * GFS2_NBBY) + bit;
 }
 
-/**
- * fs_bitcount - count the number of bits in a certain state
- * @buffer: the buffer that holds the bitmaps
- * @buflen: the length (in bytes) of the buffer
- * @state: the state of the block we're looking for
- *
- * Returns: The number of bits
- */
-uint32_t gfs2_bitcount(unsigned char *buffer, unsigned int buflen,
-  unsigned char state)
-{
-   unsigned char *byte, *end;
-   unsigned int bit;
-   uint32_t count = 0;
-
-   byte = buffer;
-   bit = 0;
-   end = buffer + buflen;
-
-   while (byte < end){
-   if (((*byte >> bit) & GFS2_BIT_MASK) == state)
-   count++;
-
-   bit += GFS2_BIT_SIZE;
-   if (bit >= 8){
-   bit = 0;
-   byte++;
-   }
-   }
-   return count;
-}
-
 /*
  * check_range - check if blkno is within FS limits
  * @sdp: super block
diff --git a/gfs2/libgfs2/fs_ops.c b/gfs2/libgfs2/fs_ops.c
index 470916c..9409332 100644
--- a/gfs2/libgfs2/fs_ops.c
+++ b/gfs2/libgfs2/fs_ops.c
@@ -1368,14 +1368,6 @@ struct gfs2_buffer_head *init_dinode(struct gfs2_sbd 
*sdp,
return __init_dinode(sdp, inum, mode, flags, parent, 0);
 }
 
-struct gfs2_buffer_head *init_gfs_dinode(struct gfs2_sbd *sdp,
-struct gfs2_inum *inum,
-unsigned int mode, uint32_t flags,
-struct gfs2_inum *parent)
-{
-   return __init_dinode(sdp, inum, mode, flags, parent, 1);
-}
-
 static struct gfs2_inode *__createi(struct gfs2_inode *dip,
const char *filename, unsigned int mode,
uint32_t flags, int if_gfs1)
diff --git a/gfs2/libgfs2/libgfs2.h b/gfs2/libgfs2/libgfs2.h
index 2fc47de..09f0b1d 100644
--- a/gfs2/libgfs2/libgfs2.h
+++ b/gfs2/libgfs2/libgfs2.h
@@ -392,8 +392,6 @@ extern void fix_device_geometry(struct gfs2_sbd *sdp);
 #define BFITNOENT (0x)
 
 /* functions with blk #'s that are buffer relative */
-extern uint32_t gfs2_bitcount(unsigned char *buffer, unsigned int buflen,
- unsigned char state);
 extern unsigned long gfs2_bitfit(const unsigned char *buffer,
 const unsigned int buflen,
 unsigned long goal, unsigned char old_state);
@@ -448,11 +446,6 @@ extern struct gfs2_buffer_head *init_dinode(struct 
gfs2_sbd *sdp,
struct gfs2_inum *inum,
unsigned int mode, uint32_t flags,
struct gfs2_inum *parent);
-extern struct gfs2_buffer_head *init_gfs_dinode(struct gfs2_sbd *sdp,
-   struct gfs2_inum *inum,
-   unsigned int mode,
-   uint32_t flags,
-   struct gfs2_inum *parent);
 extern struct gfs2_inode *createi(struct gfs2_inode *dip, const char *filename,
  unsigned int mode, uint32_t flags);
 extern struct gfs2_inode *gfs_createi(struct gfs2_inode *dip,
@@ -709,9 +702,6 @@ extern int dir_exists(const char *dir);
 extern int check_for_gfs2(struct gfs2_sbd *sdp);
 extern int mount_gfs2_meta(struct gfs2_sbd *sdp);
 exte

Re: [Cluster-devel] [PATCH] gfs2-utils: Only build group/ when gfs_controld is enabled

2012-07-04 Thread Steven Whitehouse
Hi,

Looks good to me,

Steve.

On Wed, 2012-07-04 at 12:43 +0100, Andrew Price wrote:
> The previous commit only disabled gfs_controld from building when
> --enable-gfs_controld was omitted. When we're not building gfs_controld
> there really is no reason to build anything else in the group/ directory
> so this patch disables it by default.
> 
> Signed-off-by: Andrew Price 
> ---
>  Makefile.am   |6 +-
>  group/Makefile.am |6 +-
>  2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/Makefile.am b/Makefile.am
> index 2e5d9ae..0af3e04 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -12,7 +12,11 @@ noinst_HEADERS = make/copyright.cf
>  
>  ACLOCAL_AMFLAGS  = -I m4
>  
> -SUBDIRS  = po group gfs2 doc
> +if BUILD_GFS_CONTROLD
> +DIR_GROUP= group
> +endif
> +
> +SUBDIRS  = po $(DIR_GROUP) gfs2 doc
>  
>  install-exec-local:
>   $(INSTALL) -d $(DESTDIR)/$(LOGDIR)
> diff --git a/group/Makefile.am b/group/Makefile.am
> index 2904ce1..5b7d0f8 100644
> --- a/group/Makefile.am
> +++ b/group/Makefile.am
> @@ -1,7 +1,3 @@
>  MAINTAINERCLEANFILES = Makefile.in
>  
> -if BUILD_GFS_CONTROLD
> -DIR_GFS_CONTROLD = gfs_controld
> -endif
> -
> -SUBDIRS  = libgfscontrol gfs_control $(DIR_GFS_CONTROLD) 
> man include
> +SUBDIRS  = libgfscontrol gfs_control gfs_controld man 
> include




[Cluster-devel] [PATCH] gfs2-utils: Only build group/ when gfs_controld is enabled

2012-07-04 Thread Andrew Price
The previous commit only disabled gfs_controld from building when
--enable-gfs_controld was omitted. When we're not building gfs_controld
there really is no reason to build anything else in the group/ directory
so this patch disables it by default.

Signed-off-by: Andrew Price 
---
 Makefile.am   |6 +-
 group/Makefile.am |6 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 2e5d9ae..0af3e04 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -12,7 +12,11 @@ noinst_HEADERS   = make/copyright.cf
 
 ACLOCAL_AMFLAGS= -I m4
 
-SUBDIRS= po group gfs2 doc
+if BUILD_GFS_CONTROLD
+DIR_GROUP  = group
+endif
+
+SUBDIRS= po $(DIR_GROUP) gfs2 doc
 
 install-exec-local:
$(INSTALL) -d $(DESTDIR)/$(LOGDIR)
diff --git a/group/Makefile.am b/group/Makefile.am
index 2904ce1..5b7d0f8 100644
--- a/group/Makefile.am
+++ b/group/Makefile.am
@@ -1,7 +1,3 @@
 MAINTAINERCLEANFILES   = Makefile.in
 
-if BUILD_GFS_CONTROLD
-DIR_GFS_CONTROLD   = gfs_controld
-endif
-
-SUBDIRS= libgfscontrol gfs_control $(DIR_GFS_CONTROLD) 
man include
+SUBDIRS= libgfscontrol gfs_control gfs_controld man 
include
-- 
1.7.10.2



Re: [Cluster-devel] [PATCH] mkfs.gfs2: Follow symlinks before checking device contents

2012-07-04 Thread Steven Whitehouse
Hi,

On Wed, 2012-07-04 at 12:02 +0100, Andrew Price wrote:
> On 06/28/2012 06:52 PM, Andrew Price wrote:
> > On 06/28/2012 11:01 AM, Steven Whitehouse wrote:
> >> Hi,
> >>
> >> Yes, v2 is ok too. I think I missed that in my first pass over my email
> >> today. To do this properly, we should be opening the path that we are
> >> passed, and then doing the remaining operations with just the fd. We
> >> could do that with "file" if we used the -f - option and passed the fd
> >> as standard input to the process.
> >
> > The only way I can think of passing the fd to file -f - would be the C
> > equivalent of:
> >
> >printf "/proc/$pid/fd/$fd" | file -f -
> >
> > Which would mean adding another pipe() and fork(). So we might as well
> > just shorten it to:
> >
> >file "/proc/$pid/fd/$fd"
> >
> > Would this solve the race condition problem? Or am I misunderstanding
> > how you intended it to be done?
> 
> I didn't get a reply to this. Does the above method seem sensible or 
> would we need to read the start of the file/device ourselves and pipe it 
> into 'file -' to avoid opening the file twice?
> 
> Andy
> 
Yes, that should work too. The intent is to avoid any issues with the
name changing from when mkfs opens the device to when the device is
checked, so any method based on using the open fd, rather than parsing
the path a second time is ok,

Steve.

> >> That way we also remove any possible race conditions too, but this is
> >> good enough for now,
> >>
> >> Steve.
> >>
> >>
> >> On Thu, 2012-06-28 at 10:58 +0100, Andrew Price wrote:
> >>> Hi Steve,
> >>>
> >>> On 06/28/2012 10:16 AM, Steven Whitehouse wrote:
>  Hi,
> 
>  Looks good. ACK,
> >>>
> >>> This one was obsoleted by the v2 patch I posted on the 21st. If you
> >>> prefer this one though I can push it instead.
> >>>
> >>> Andy
> >>>
> 
>  Steve.
> 
>  On Wed, 2012-06-20 at 16:47 +0100, Andrew Price wrote:
> > When using symlinks with mkfs.gfs2 it reports what the symlink points
> > to instead of the contents of the device, like so:
> >
> ># ./mkfs.gfs2 -p lock_nolock /dev/vg/test
> >This will destroy any data on /dev/vg/test.
> >It appears to contain: symbolic link to `../dm-3'
> >
> > This patch resolves symlinks before checking the device contents to
> > make
> > the output more informative:
> >
> ># ./mkfs.gfs2 -p lock_nolock /dev/vg/test
> >This will destroy any data on /dev/vg/test.
> >It appears to contain: GFS2 Filesystem (blocksize 4096,
> > lockproto lock_nolock)
> >
> > Signed-off-by: Andrew Price 
> > ---
> >gfs2/mkfs/main_mkfs.c |9 -
> >1 files changed, 8 insertions(+), 1 deletions(-)
> >
> > diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
> > index e6b00a0..f8e4741 100644
> > --- a/gfs2/mkfs/main_mkfs.c
> > +++ b/gfs2/mkfs/main_mkfs.c
> > @@ -531,6 +531,7 @@ void main_mkfs(int argc, char *argv[])
> >int error;
> >int rgsize_specified = 0;
> >unsigned char uuid[16];
> > +char *absname;
> >
> >memset(sdp, 0, sizeof(struct gfs2_sbd));
> >sdp->bsize = -1;
> > @@ -560,11 +561,17 @@ void main_mkfs(int argc, char *argv[])
> >exit(EXIT_FAILURE);
> >}
> >
> > +absname = canonicalize_file_name(sdp->device_name);
> > +if (absname == NULL) {
> > +perror(_("Could not find the absolute path of the device"));
> > +exit(EXIT_FAILURE);
> > +}
> >if (!sdp->override) {
> >printf( _("This will destroy any data on %s.\n"),
> > sdp->device_name);
> > -check_dev_content(sdp->device_name);
> > +check_dev_content(absname);
> >are_you_sure();
> >}
> > +free(absname);
> >
> >if (sdp->bsize == -1) {
> >if (S_ISREG(sdp->dinfo.stat.st_mode))
> 
> 
> >>>
> >>>
> >>
> >>
> >
> >
> 
> 




Re: [Cluster-devel] [PATCH 4/5] rgmanager: Treat exit status 16 from umount as success

2012-07-04 Thread Fabio M. Di Nitto
ACK, but please add Masatake YAMATO suggestion to the final patch.

Fabio

On 6/28/2012 9:57 PM, Ryan McCabe wrote:
> When the filesystem /etc lives on is completely full, umount will exit
> with exit status 16 if the umount syscall succeeded but it was unable to write
> a new mtab file because the disk is full. umount won't exit with status 16
> under any other circumstances.
> 
> This patch changes the fs.sh, clusterfs.sh, and netfs.sh resource agents
> to check treat both exit status 0 and exit status 16 as success.
> 
> Resolves: rhbz#819595
> 
> Signed-off-by: Ryan McCabe 
> ---
>  rgmanager/src/resources/clusterfs.sh |3 ++-
>  rgmanager/src/resources/fs.sh|3 ++-
>  rgmanager/src/resources/netfs.sh |3 ++-
>  3 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/rgmanager/src/resources/clusterfs.sh 
> b/rgmanager/src/resources/clusterfs.sh
> index 49eb724..eae1ee0 100755
> --- a/rgmanager/src/resources/clusterfs.sh
> +++ b/rgmanager/src/resources/clusterfs.sh
> @@ -793,7 +793,8 @@ stop: Could not match $OCF_RESKEY_device with a real 
> device"
>   ocf_log info "unmounting $dev ($mp)"
>  
>   umount $mp
> - if  [ $? -eq 0 ]; then
> + retval=$?
> + if  [ $retval -eq 0 -o $retval -eq 16 ]; then
>   umount_failed=
>   done=$YES
>   continue
> diff --git a/rgmanager/src/resources/fs.sh b/rgmanager/src/resources/fs.sh
> index a98cddc..5d6bc1b 100755
> --- a/rgmanager/src/resources/fs.sh
> +++ b/rgmanager/src/resources/fs.sh
> @@ -1103,7 +1103,8 @@ stop: Could not match $OCF_RESKEY_device with a real 
> device"
>  
>   ocf_log info "unmounting $mp"
>   umount $mp
> - if  [ $? -eq 0 ]; then
> + retval=$?
> + if  [ $retval -eq 0 -o $retval -eq 16 ]; then
>   umount_failed=
>   done=$YES
>   continue
> diff --git a/rgmanager/src/resources/netfs.sh 
> b/rgmanager/src/resources/netfs.sh
> index 837a4c4..9f0daa4 100755
> --- a/rgmanager/src/resources/netfs.sh
> +++ b/rgmanager/src/resources/netfs.sh
> @@ -560,7 +560,8 @@ stopNFSFilesystem() {
>   ocf_log info "unmounting $mp"
>  
>  umount $umount_flag $mp
> - if  [ $? -eq 0 ]; then
> + retval=$?
> + if  [ $retval -eq 0 -o $retval -eq 16 ]; then
>  umount_failed=
>  done=$YES
>  continue
> 




Re: [Cluster-devel] [PATCH 5/5] rgmanager: Fix a possible NULL pointer dereference

2012-07-04 Thread Fabio M. Di Nitto
ACK

On 6/28/2012 9:58 PM, Ryan McCabe wrote:
> Fix a NULL pointer dereference that could happen when cman_get_node_count()
> returns 0 with errno set to EINTR.
> 
> Possibly resolves rhbz#820632
> 
> Signed-off-by: Ryan McCabe 
> ---
>  rgmanager/src/clulib/members.c |4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/rgmanager/src/clulib/members.c b/rgmanager/src/clulib/members.c
> index f705297..72f4529 100644
> --- a/rgmanager/src/clulib/members.c
> +++ b/rgmanager/src/clulib/members.c
> @@ -367,8 +367,10 @@ get_member_list(cman_handle_t h)
>  
>   do {
>   ++tries;
> - if (nodes)
> + if (nodes) {
>   free(nodes);
> + nodes = NULL;
> + }
>  
>   c = cman_get_node_count(h);
>   if (c <= 0) {
> 




Re: [Cluster-devel] [PATCH 3/5] rgmanager: Don't immediately stop services that have started sucessfully

2012-07-04 Thread Fabio M. Di Nitto
ACK

On 6/28/2012 9:57 PM, Ryan McCabe wrote:
> This patch fixes a bug that caused services to be started, then
> immediately stopped during recovery. This occurred when a service
> had its recovery policy set to relocate and was in a restricted
> failover domain. If starting the service failed on other nodes in the
> failover domain, the service would be restarted on the original node,
> then immediately stopped, even if it had started successfully. This
> patch causes rgmanager to leave the service running if it restarted
> successfully.
> 
> Resolves: rhbz#789366
> 
> Signed-off-by: Ryan McCabe 
> ---
>  rgmanager/src/daemons/rg_state.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/rgmanager/src/daemons/rg_state.c 
> b/rgmanager/src/daemons/rg_state.c
> index a8b1e36..4357d21 100644
> --- a/rgmanager/src/daemons/rg_state.c
> +++ b/rgmanager/src/daemons/rg_state.c
> @@ -2061,7 +2061,7 @@ exhausted:
>  svcName);
>   if (svc_start(svcName, RG_START_RECOVER) == 0) {
>   *new_owner = me;
> - return RG_EFAIL;
> + return 0;
>   }
>   }
>  
> 




Re: [Cluster-devel] [PATCH 2/5] rgmanager: Don't exit uncleanly when cman asks us to shut down.

2012-07-04 Thread Fabio M. Di Nitto
ACK

On 6/28/2012 9:57 PM, Ryan McCabe wrote:
> Original patch from Lon rediffed to apply to the current tree:
> 
> "Previous to this, rgmanager would uncleanly exit if you
> issued a 'service cman stop'.  This patch makes it uncleanly
> exit if 'cman_tool leave force' or a corosync/openais crash
> occurs, but in a simple cman_tool leave, rgmanager will no
> longer exit uncleanly."
> 
> Without this patch, issuing 'service cman stop' when rgmanager
> is running will make it impossible to stop the cman service because
> rgmanager will have exited without releasing its dlm lockspace.
> 
> Resolves: rhbz#769730
> 
> Signed-off-by: Ryan McCabe 
> ---
>  rgmanager/src/clulib/msg_cluster.c |7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/rgmanager/src/clulib/msg_cluster.c 
> b/rgmanager/src/clulib/msg_cluster.c
> index 8dc22d0..e864853 100644
> --- a/rgmanager/src/clulib/msg_cluster.c
> +++ b/rgmanager/src/clulib/msg_cluster.c
> @@ -211,7 +211,7 @@ poll_cluster_messages(int timeout)
>  
>   if (cman_dispatch(ch, 0) < 0) {
>   process_cman_event(ch, NULL,
> -CMAN_REASON_TRY_SHUTDOWN, 0);
> +CMAN_REASON_TRY_SHUTDOWN, 1);
>   }
>   ret = 0;
>   }
> @@ -987,6 +987,11 @@ process_cman_event(cman_handle_t handle, void *private, 
> int reason, int arg)
>   printf("EVENT: %p %p %d %d\n", handle, private, reason, arg);
>  #endif
>  
> + if (reason == CMAN_REASON_TRY_SHUTDOWN && !arg) {
> + cman_replyto_shutdown(handle, 0);
> + return;
> + }
> +
>   /* Allocate queue node */
>   while ((node = malloc(sizeof(*node))) == NULL) {
>   sleep(1);
> 




Re: [Cluster-devel] [PATCH 1/5] rgmanager: Fix orainstance.sh error checking

2012-07-04 Thread Fabio M. Di Nitto
ACK

On 6/28/2012 9:57 PM, Ryan McCabe wrote:
> Pull in the fixed error checking that was added to oracledb.sh as a
> fix for rhbz#471066.
> 
> Resolves: rhbz#723819
> 
> Signed-off-by: Ryan McCabe  --- 
> rgmanager/src/resources/orainstance.sh |4 ++-- 1 file changed,
> 2 insertions(+), 2 deletions(-)
> 
> diff --git a/rgmanager/src/resources/orainstance.sh
> b/rgmanager/src/resources/orainstance.sh index 6f2ff15..a9f690d
> 100755 --- a/rgmanager/src/resources/orainstance.sh +++
> b/rgmanager/src/resources/orainstance.sh @@ -105,7 +105,7 @@
> start_db() {
> 
> # If we see: # ORA-.: failure, we failed -grep -q "failure"
> $logfile +grep -q "^ORA-" $logfile rv=$?
> 
> rm -f $logfile @@ -155,7 +155,7 @@ stop_db() { return 1 fi
> 
> - grep -q failure $logfile +  grep -q "^ORA-" $logfile rv=$? rm -f
> $logfile
> 
> 




Re: [Cluster-devel] [PATCH] gfs2-utils: Make building gfs2_controld optional

2012-07-04 Thread Fabio M. Di Nitto
On 7/3/2012 8:00 PM, Andrew Price wrote:

> diff --git a/group/Makefile.am b/group/Makefile.am
> index 5b7d0f8..2904ce1 100644
> --- a/group/Makefile.am
> +++ b/group/Makefile.am
> @@ -1,3 +1,7 @@
>  MAINTAINERCLEANFILES = Makefile.in
>  
> -SUBDIRS  = libgfscontrol gfs_control gfs_controld man 
> include
> +if BUILD_GFS_CONTROLD
> +DIR_GFS_CONTROLD = gfs_controld
> +endif
> +
> +SUBDIRS  = libgfscontrol gfs_control $(DIR_GFS_CONTROLD) 
> man include
> 

Is there actually a reason to build group/ at all, if gfs_controld is
disabled?

Fabio



Re: [Cluster-devel] [PATCH] mkfs.gfs2: Follow symlinks before checking device contents

2012-07-04 Thread Andrew Price

On 06/28/2012 06:52 PM, Andrew Price wrote:

On 06/28/2012 11:01 AM, Steven Whitehouse wrote:

Hi,

Yes, v2 is ok too. I think I missed that in my first pass over my email
today. To do this properly, we should be opening the path that we are
passed, and then doing the remaining operations with just the fd. We
could do that with "file" if we used the -f - option and passed the fd
as standard input to the process.


The only way I can think of passing the fd to file -f - would be the C
equivalent of:

   printf "/proc/$pid/fd/$fd" | file -f -

Which would mean adding another pipe() and fork(). So we might as well
just shorten it to:

   file "/proc/$pid/fd/$fd"

Would this solve the race condition problem? Or am I misunderstanding
how you intended it to be done?


I didn't get a reply to this. Does the above method seem sensible or 
would we need to read the start of the file/device ourselves and pipe it 
into 'file -' to avoid opening the file twice?


Andy


That way we also remove any possible race conditions too, but this is
good enough for now,

Steve.


On Thu, 2012-06-28 at 10:58 +0100, Andrew Price wrote:

Hi Steve,

On 06/28/2012 10:16 AM, Steven Whitehouse wrote:

Hi,

Looks good. ACK,


This one was obsoleted by the v2 patch I posted on the 21st. If you
prefer this one though I can push it instead.

Andy



Steve.

On Wed, 2012-06-20 at 16:47 +0100, Andrew Price wrote:

When using symlinks with mkfs.gfs2 it reports what the symlink points
to instead of the contents of the device, like so:

   # ./mkfs.gfs2 -p lock_nolock /dev/vg/test
   This will destroy any data on /dev/vg/test.
   It appears to contain: symbolic link to `../dm-3'

This patch resolves symlinks before checking the device contents to
make
the output more informative:

   # ./mkfs.gfs2 -p lock_nolock /dev/vg/test
   This will destroy any data on /dev/vg/test.
   It appears to contain: GFS2 Filesystem (blocksize 4096,
lockproto lock_nolock)

Signed-off-by: Andrew Price 
---
   gfs2/mkfs/main_mkfs.c |9 -
   1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/gfs2/mkfs/main_mkfs.c b/gfs2/mkfs/main_mkfs.c
index e6b00a0..f8e4741 100644
--- a/gfs2/mkfs/main_mkfs.c
+++ b/gfs2/mkfs/main_mkfs.c
@@ -531,6 +531,7 @@ void main_mkfs(int argc, char *argv[])
   int error;
   int rgsize_specified = 0;
   unsigned char uuid[16];
+char *absname;

   memset(sdp, 0, sizeof(struct gfs2_sbd));
   sdp->bsize = -1;
@@ -560,11 +561,17 @@ void main_mkfs(int argc, char *argv[])
   exit(EXIT_FAILURE);
   }

+absname = canonicalize_file_name(sdp->device_name);
+if (absname == NULL) {
+perror(_("Could not find the absolute path of the device"));
+exit(EXIT_FAILURE);
+}
   if (!sdp->override) {
   printf( _("This will destroy any data on %s.\n"),
sdp->device_name);
-check_dev_content(sdp->device_name);
+check_dev_content(absname);
   are_you_sure();
   }
+free(absname);

   if (sdp->bsize == -1) {
   if (S_ISREG(sdp->dinfo.stat.st_mode))

















Re: [Cluster-devel] [PATCH] gfs2-utils: Make building gfs2_controld optional

2012-07-04 Thread Steven Whitehouse
Hi,

Looks good to me. Thanks,

Steve.

On Tue, 2012-07-03 at 19:00 +0100, Andrew Price wrote:
> As of Fedora 17 gfs_controld isn't required and also doesn't build. This
> patch adds an --enable-gfs_controld option to allow it to be built on
> older systems while defaulting to future norm of not building it.
> 
> Signed-off-by: Andrew Price 
> ---
>  README.build  |6 ++
>  configure.ac  |   27 ++-
>  group/Makefile.am |6 +-
>  3 files changed, 29 insertions(+), 10 deletions(-)
> 
> diff --git a/README.build b/README.build
> index 007f2d7..27e022a 100644
> --- a/README.build
> +++ b/README.build
> @@ -21,6 +21,12 @@ Plus the following libraries:
>- libcfg
>   - openaislib
>  
> +By default gfs_controld is not built as it is not required in Fedora 17 and
> +later and cannot build on it. To re-enable it for older systems, use
> +--enable-gfs_controld when running the configure script (see below). The
> +library dependencies for gfs_controld are only required when this option is
> +given.
> +
>  Run the following commands:
>  
>  ./autogen.sh
> diff --git a/configure.ac b/configure.ac
> index 570f826..d56cfac 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -95,6 +95,10 @@ AC_ARG_ENABLE([debug],
>   [  --enable-debug  enable debug build. ],
>   [ default="no" ])
>  
> +AC_ARG_ENABLE([gfs_controld],
> + [  --enable-gfs_controld   build gfs_controld. ],
> + [ default="no" ])
> +
>  AC_ARG_WITH([syslogfacility],
>   [  --syslogfacility=FACILITY
>cluster default syslog facility. ],
> @@ -114,15 +118,20 @@ AC_ARG_WITH([kernel],
>  
>  KERNEL_CPPFLAGS="-I$KERNEL_DIR/include"
>  
> -PKG_CHECK_MODULES([corosync],[corosync])
> -PKG_CHECK_MODULES([cpg],[libcpg])
> -PKG_CHECK_MODULES([sackpt],[libSaCkpt])
> -PKG_CHECK_MODULES([logt],[liblogthread])
> -PKG_CHECK_MODULES([ccs],[libccs])
> -PKG_CHECK_MODULES([cfg],[libcfg])
> -PKG_CHECK_MODULES([fenced],[libfenced])
> -PKG_CHECK_MODULES([dlmcontrol],[libdlmcontrol])
> -PKG_CHECK_MODULES([quorum],[libquorum])
> +# gfs_controld isn't required in the latest versions of cluster
> +AM_CONDITIONAL([BUILD_GFS_CONTROLD], [test "x$enable_gfs_controld" = "xyes"])
> +AS_IF([test "x$enable_gfs_controld" = "xyes"], [
> + PKG_CHECK_MODULES([corosync],[corosync])
> + PKG_CHECK_MODULES([cpg],[libcpg])
> + PKG_CHECK_MODULES([sackpt],[libSaCkpt])
> + PKG_CHECK_MODULES([logt],[liblogthread])
> + PKG_CHECK_MODULES([ccs],[libccs])
> + PKG_CHECK_MODULES([cfg],[libcfg])
> + PKG_CHECK_MODULES([fenced],[libfenced])
> + PKG_CHECK_MODULES([dlmcontrol],[libdlmcontrol])
> + PKG_CHECK_MODULES([quorum],[libquorum])
> +])
> +
>  PKG_CHECK_MODULES([zlib],[zlib])
>  
>  # old versions of ncurses don't ship pkg-config files
> diff --git a/group/Makefile.am b/group/Makefile.am
> index 5b7d0f8..2904ce1 100644
> --- a/group/Makefile.am
> +++ b/group/Makefile.am
> @@ -1,3 +1,7 @@
>  MAINTAINERCLEANFILES = Makefile.in
>  
> -SUBDIRS  = libgfscontrol gfs_control gfs_controld man 
> include
> +if BUILD_GFS_CONTROLD
> +DIR_GFS_CONTROLD = gfs_controld
> +endif
> +
> +SUBDIRS  = libgfscontrol gfs_control $(DIR_GFS_CONTROLD) 
> man include