From 204c575fd3a6684c2d7e74883d197a28400a81de Mon Sep 17 00:00:00 2001 From: bobijam Date: Tue, 10 Jul 2007 02:39:34 +0000 Subject: [PATCH] Branch b1_6 b=12784 i=green i=adilger Original patch by miles@cray.com Description: bad return value and errno from fcntl call Details : In liblustre API, errno should be a negative value if error happens. --- lustre/ChangeLog | 6 ++++++ lustre/liblustre/super.c | 10 +++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 2cdfe82..7d2f827 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -443,6 +443,12 @@ Description: replace obdo_alloc() with OBDO_ALLOC macro Details : nothing special is done in obdo_alloc() function, and for debugging purpose, it needs to be replaced with macros. +Severity : normal +Bugzilla : 12784 +Description: bad return value and errno from fcntl call +Details : In liblustre API, errno should be a negative value if error + happens. + -------------------------------------------------------------------------------- 2007-05-03 Cluster File Systems, Inc. diff --git a/lustre/liblustre/super.c b/lustre/liblustre/super.c index 6267ce5..93260a9 100644 --- a/lustre/liblustre/super.c +++ b/lustre/liblustre/super.c @@ -1397,7 +1397,7 @@ static int llu_fcntl_getlk(struct inode *ino, struct flock *flock) struct file_lock fl; int error; - error = EINVAL; + error = -EINVAL; if ((flock->l_type != F_RDLCK) && (flock->l_type != F_WRLCK)) goto out; @@ -1479,8 +1479,8 @@ static int llu_iop_fcntl(struct inode *ino, int cmd, va_list ap, int *rtn) LCONSOLE_ERROR_MSG(0x010, "liblustre does not support " "the O_NONBLOCK or O_ASYNC flags. " "Please fix your application.\n"); - *rtn = -EINVAL; - err = EINVAL; + *rtn = -1; + err = -EINVAL; break; } lli->lli_open_flags = (int)(flags & FCNTL_FLMASK) | @@ -1515,8 +1515,8 @@ static int llu_iop_fcntl(struct inode *ino, int cmd, va_list ap, int *rtn) break; default: CERROR("unsupported fcntl cmd %x\n", cmd); - *rtn = -ENOSYS; - err = ENOSYS; + *rtn = -1; + err = -ENOSYS; break; } -- 1.8.3.1