[Pvfs2-developers] patches: bug fixes

Sam Lang slang at mcs.anl.gov
Tue Sep 26 12:06:45 EDT 2006


Hi Phil,

Just an FYI, these patches have been committed to CVS.

-sam

On Sep 5, 2006, at 1:39 PM, Phil Carns wrote:

> pread-pwrite.patch:
> -------------------
> This fixes a bug in a patch that I submitted earlier to provide a  
> simple alternate AIO implementation.  It defines _GNU_SOURCE in a  
> limited area for dbpf so that we can get proper definitions of pread 
> () and pwrite() on Linux.  I tried using _XOPEN_SOURCE=500, but it  
> will break any .c file that includes dbpf.h due to  
> incompatibilities with Berkeley DB.
>
> zero-dfile.patch:
> -------------------
> This fixes a bug in the getattr handling on pvfs2-server if it  
> happens to find an attribute structure with the dfile array zeroed  
> out.  In this case, it needs to set the attr flag appropriately to  
> prevent the response encoder from segfaulting while processing the  
> array in the response structure.  This condition is very hard to  
> trigger, but the server should be able to gracefully report the  
> error rather than crashing.
>
> -Phil
> Index: pvfs2_src/src/io/trove/trove-dbpf/dbpf-bstream.c
> ===================================================================
> --- pvfs2_src/src/io/trove/trove-dbpf/dbpf-bstream.c	(revision 2444)
> +++ pvfs2_src/src/io/trove/trove-dbpf/dbpf-bstream.c	(revision 2445)
> @@ -1424,8 +1424,8 @@
>  }
>
>  /* prototypes for pread and pwrite; _XOPEN_SOURCE causes db.h  
> problems */
> -ssize_t pread(int fd, void *buf, size_t count, off_t offset);
> -ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);
> +ssize_t pread64(int fd, void *buf, size_t count, off64_t offset);
> +ssize_t pwrite64(int fd, const void *buf, size_t count, off64_t  
> offset);
>  static void* alt_lio_thread(void* foo)
>  {
>      struct alt_aio_item* tmp_item = (struct alt_aio_item*)foo;
> @@ -1433,14 +1433,14 @@
>
>      if(tmp_item->cb_p->aio_lio_opcode == LIO_READ)
>      {
> -        ret = pread(tmp_item->cb_p->aio_fildes,
> +        ret = pread64(tmp_item->cb_p->aio_fildes,
>              (void*)tmp_item->cb_p->aio_buf,
>              tmp_item->cb_p->aio_nbytes,
>              tmp_item->cb_p->aio_offset);
>      }
>      else if(tmp_item->cb_p->aio_lio_opcode == LIO_WRITE)
>      {
> -        ret = pwrite(tmp_item->cb_p->aio_fildes,
> +        ret = pwrite64(tmp_item->cb_p->aio_fildes,
>              (const void*)tmp_item->cb_p->aio_buf,
>              tmp_item->cb_p->aio_nbytes,
>              tmp_item->cb_p->aio_offset);
> Index: pvfs2_src/src/io/trove/trove-dbpf/dbpf-bstream.c
> ===================================================================
> --- pvfs2_src/src/io/trove/trove-dbpf/dbpf-bstream.c	(revision 2460)
> +++ pvfs2_src/src/io/trove/trove-dbpf/dbpf-bstream.c	(revision 2461)
> @@ -1423,9 +1423,6 @@
>      return(0);
>  }
>
> -/* prototypes for pread and pwrite; _XOPEN_SOURCE causes db.h  
> problems */
> -ssize_t pread64(int fd, void *buf, size_t count, off64_t offset);
> -ssize_t pwrite64(int fd, const void *buf, size_t count, off64_t  
> offset);
>  static void* alt_lio_thread(void* foo)
>  {
>      struct alt_aio_item* tmp_item = (struct alt_aio_item*)foo;
> @@ -1433,14 +1430,14 @@
>
>      if(tmp_item->cb_p->aio_lio_opcode == LIO_READ)
>      {
> -        ret = pread64(tmp_item->cb_p->aio_fildes,
> +        ret = pread(tmp_item->cb_p->aio_fildes,
>              (void*)tmp_item->cb_p->aio_buf,
>              tmp_item->cb_p->aio_nbytes,
>              tmp_item->cb_p->aio_offset);
>      }
>      else if(tmp_item->cb_p->aio_lio_opcode == LIO_WRITE)
>      {
> -        ret = pwrite64(tmp_item->cb_p->aio_fildes,
> +        ret = pwrite(tmp_item->cb_p->aio_fildes,
>              (const void*)tmp_item->cb_p->aio_buf,
>              tmp_item->cb_p->aio_nbytes,
>              tmp_item->cb_p->aio_offset);
> Index: pvfs2_src/src/io/trove/trove-dbpf/module.mk.in
> ===================================================================
> --- pvfs2_src/src/io/trove/trove-dbpf/module.mk.in	(revision 2460)
> +++ pvfs2_src/src/io/trove/trove-dbpf/module.mk.in	(revision 2461)
> @@ -16,5 +16,7 @@
>  	$(DIR)/dbpf-keyval-pcache.c \
>  	$(DIR)/dbpf-sync.c
>
> -# grab trove-ledger.h from handle-mgmt.
> -MODCFLAGS_$(DIR) = -I$(srcdir)/src/io/trove/trove-handle-mgmt
> +# Grab trove-ledger.h from handle-mgmt.  Also make _GNU_SOURCE  
> definition
> +# required for access to pread/pwrite on Linux.  _XOPEN_SOURCE  
> seems to be
> +# incompatible with Berkeley DB.
> +MODCFLAGS_$(DIR) = -I$(srcdir)/src/io/trove/trove-handle-mgmt - 
> D_GNU_SOURCE
> Index: pvfs2_src/src/server/get-attr.sm
> ===================================================================
> --- pvfs2_src/src/server/get-attr.sm	(revision 2366)
> +++ pvfs2_src/src/server/get-attr.sm	(revision 2367)
> @@ -512,6 +512,10 @@
>  	    llu(s_op->u.getattr.handle), llu(s_op->u.getattr.handle),
>  	    (int)s_op->u.getattr.fs_id);
>
> +        /*If we hit an error the DIST & DFILES are no longer valid*/
> +        s_op->resp.u.getattr.attr.mask &= ~PVFS_ATTR_META_DIST;
> +        s_op->resp.u.getattr.attr.mask &= ~PVFS_ATTR_META_DFILES;
> +
>  	js_p->error_code = -PVFS_EOVERFLOW;
>  	return 1;
>      }
> @@ -624,6 +628,14 @@
>           */
>          js_p->error_code = 0;
>      }
> +    if(js_p->error_code < 0)
> +    {
> +        if(s_op->val.buffer)
> +        {
> +            free(s_op->val.buffer);
> +        }
> +        return 1;
> +    }
>
>      gossip_debug(
>          GOSSIP_GETATTR_DEBUG,
> _______________________________________________
> Pvfs2-developers mailing list
> Pvfs2-developers at beowulf-underground.org
> http://www.beowulf-underground.org/mailman/listinfo/pvfs2-developers



More information about the Pvfs2-developers mailing list