[Ocfs2-tools-devel] [PATCH 3/6] libo2dlm: Detect invalid LVBs

Sunil Mushran sunil.mushran at oracle.com
Fri Mar 5 17:29:14 PST 2010


sob

Joel Becker wrote:
> When a DLM does recovery, it may have to invalidate the contents of an
> LVB or two.  The DLMs provide a method to detect this.  dlmfs has
> learned to report this via a zero-length read(2).  libo2dlm now notices
> the zero length and returns an error to the caller.
>
> Signed-off-by: Joel Becker <joel.becker at oracle.com>
> ---
>  libo2dlm/o2dlm.c      |    2 ++
>  libo2dlm/o2dlm_err.et |    3 +++
>  2 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/libo2dlm/o2dlm.c b/libo2dlm/o2dlm.c
> index bf708e7..ee7f34c 100644
> --- a/libo2dlm/o2dlm.c
> +++ b/libo2dlm/o2dlm.c
> @@ -564,6 +564,8 @@ static errcode_t o2dlm_read_lvb_classic(struct o2dlm_ctxt *ctxt,
>  	ret = read(fd, lvb, len);
>  	if (ret < 0)
>  		return O2DLM_ET_LVB_READ;
> +	if (!ret)
> +		return O2DLM_ET_LVB_INVALID;
>  
>  	if (bytes_read)
>  		*bytes_read = ret;
> diff --git a/libo2dlm/o2dlm_err.et b/libo2dlm/o2dlm_err.et
> index 184e295..9b757c8 100644
> --- a/libo2dlm/o2dlm_err.et
> +++ b/libo2dlm/o2dlm_err.et
> @@ -114,4 +114,7 @@ ec	O2DLM_ET_DOMAIN_BUSY,
>  ec	O2DLM_ET_BAST_UNSUPPORTED,
>  	"This environment does not support BASTs"
>  
> +ec	O2DLM_ET_LVB_INVALID,
> +	"The LVB is not valid"
> +
>  	end
>   




More information about the Ocfs2-tools-devel mailing list