Whamcloud - gitweb
LU-3403 llite: error of listxattr when buffer is small 63/6463/8
authorKeith Mannthey <keith.mannthey@intel.com>
Tue, 18 Jun 2013 16:36:31 +0000 (09:36 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 10 Jul 2013 02:44:40 +0000 (02:44 +0000)
According to the standard, listxattr(2) should return -1
and errno should be set to ERANGE if the size of the list
buffer is too small to hold the result. However ll_listxattr()
will return a value bigger than the size of buffer in some cases.

Let's assume listxattr(2) returns SIZE when it is called with a
large enough list buffer. If it's called again with a list buffer
whose size is smaller than SIZE but bigger than (SIZE - 12), then
listxattr(2) will return SIZE too. This patch fixes the problem.
Original patch by Li Xi <pkuelelixi@gmail.com>

Signed-off-by: Keith Mannthey <keith.mannthey@intel.com>
Change-Id: Ifb29ae900a5ee57dfde8781f7a008b6129c7bf91
Reviewed-on: http://review.whamcloud.com/6463
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Li Xi <pkuelelixi@gmail.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>

No differences found