From patchwork Wed Apr 17 17:04:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yehuda Sadeh X-Patchwork-Id: 2454671 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id DE9533FC64 for ; Wed, 17 Apr 2013 17:04:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755645Ab3DQREZ (ORCPT ); Wed, 17 Apr 2013 13:04:25 -0400 Received: from mail-ia0-f175.google.com ([209.85.210.175]:39673 "EHLO mail-ia0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754425Ab3DQREY (ORCPT ); Wed, 17 Apr 2013 13:04:24 -0400 Received: by mail-ia0-f175.google.com with SMTP id e16so1625118iaa.6 for ; Wed, 17 Apr 2013 10:04:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:x-gm-message-state; bh=7fh3X1pyUQoU8AtBtB5DitmE/Wt8Q0B96kboWjp0Z08=; b=pruj/mdMdlGmr1qR0T5nKEcijVyvMBinUm9+dI49SJBLSDOGm4gc8fzKHh/jWll/x6 UEOWU4RTzdwWQqVr0YGimJXNsAWvLCfZskzAvRjRWefDI5XlQjKyB5x0Okv63TRMHWP8 V0gFvtIhaRcS+rT5kvB5NTE5QRR8h8Y+AgYF3CFzccpwzzZkyfyrcH2UCESA5zp3ALnW yotBa8UGVy+fdvWsExB7sEnWij9/4GRbXjApIVHUHVjhWXQqLA0aX2hAFZzFZQRRyCfU piWZfJuShsJhDikfg4HCXtb+Ei0EcQsiHWZqC0A7OkNEhT2fscq/JjtTYUHifz1nw8u4 3XbA== MIME-Version: 1.0 X-Received: by 10.50.119.39 with SMTP id kr7mr4718388igb.19.1366218264109; Wed, 17 Apr 2013 10:04:24 -0700 (PDT) Received: by 10.64.86.6 with HTTP; Wed, 17 Apr 2013 10:04:23 -0700 (PDT) In-Reply-To: <516ECFB6.8090107@gmail.com> References: <516E7D5C.7080309@nazarianin.com> <516ECFB6.8090107@gmail.com> Date: Wed, 17 Apr 2013 10:04:23 -0700 Message-ID: Subject: Re: test osd on zfs From: Yehuda Sadeh To: Jeff Mitchell Cc: Henry C Chang , Sage Weil , Aleksey Leonov , ceph-devel X-Gm-Message-State: ALoCoQk52kIw66Th8sLECBZy0+7IR4rJu3EFOiNEA7Ux9QrS6JMinCgADztDVQ/5KcPUaLX66OWP Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org On Wed, Apr 17, 2013 at 9:37 AM, Jeff Mitchell wrote: > Henry C Chang wrote: >> >> I looked into this problem earlier. The problem is that zfs does not >> return ERANGE when the size of value buffer passed to getxattr is too >> small. zfs returns with truncated xattr value. > > > Is this a bug in ZFS, or simply different behavior? Took a brief look at the zfs code, seems like a zfs bug. return (MIN(size, nv_size)); This should fix it. Not tested of course. Yehuda --- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/module/zfs/zpl_xattr.c b/module/zfs/zpl_xattr.c index c03764f..96db7dd 100644 --- a/module/zfs/zpl_xattr.c +++ b/module/zfs/zpl_xattr.c @@ -263,6 +263,9 @@ zpl_xattr_get_sa(struct inode *ip, const char *name, void *value, size_t size) if (!size) return (nv_size); + if (size < nv_size) + return (-ERANGE); + memcpy(value, nv_value, MIN(size, nv_size));