From patchwork Wed Aug 31 13:01:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 9307185 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 48EB3601C0 for ; Wed, 31 Aug 2016 13:02:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3ABF428DE4 for ; Wed, 31 Aug 2016 13:02:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2FCD228F28; Wed, 31 Aug 2016 13:02:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8DF3D28F24 for ; Wed, 31 Aug 2016 13:02:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934382AbcHaNCG (ORCPT ); Wed, 31 Aug 2016 09:02:06 -0400 Received: from hr2.samba.org ([144.76.82.148]:31422 "EHLO hr2.samba.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934320AbcHaNBz (ORCPT ); Wed, 31 Aug 2016 09:01:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=samba.org; s=42627210; h=Message-Id:Date:Cc:To:From; bh=o3Z7RNIKQ9OgMPJmddV3Qismf3ZdxBJqK6d9c5CVXyA=; b=Y7aYA91YXEx93CjckZIeY8TPQ3RQ/ZyE8+LBgm+hLiaPbCNtpcWKjcsD4slqp92u49jclzwjvYEIb5EDsxppRsCeqzGbK78j+ug+LFK0mTK/l1ZIkRyftBCdqu6tl++Gb7ndH/R6N9aS3u+xu5WUswZXAUTER7jkvVg+fJNsA58=; Received: from [127.0.0.2] (localhost [127.0.0.1]) by hr2.samba.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim) id 1bf59O-0003ib-DB; Wed, 31 Aug 2016 13:01:54 +0000 From: Jeff Layton To: samba-technical@lists.samba.org Cc: ira@wakeful.net, ceph-devel@vger.kernel.org Subject: [samba RFC PATCH 5/6] vfs:ceph: convert cephwrap_lstat to use ceph_statx Date: Wed, 31 Aug 2016 09:01:13 -0400 Message-Id: <1472648474-3131-6-git-send-email-jlayton@samba.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1472648474-3131-1-git-send-email-jlayton@samba.org> References: <1472648474-3131-1-git-send-email-jlayton@samba.org> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We can use AT_SYMLINK_NOFOLLOW flag to get the right lookup semantics. Signed-off-by: Jeff Layton --- source3/modules/vfs_ceph.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c index a1480201c628..b3c26ad4f4c1 100644 --- a/source3/modules/vfs_ceph.c +++ b/source3/modules/vfs_ceph.c @@ -624,6 +624,30 @@ static int cephwrap_fstat(struct vfs_handle_struct *handle, files_struct *fsp, S return result; } +static int cephwrap_lstat(struct vfs_handle_struct *handle, + struct smb_filename *smb_fname) +{ + int result = -1; + struct ceph_statx stx; + + DEBUG(10, ("[CEPH] lstat(%p, %s)\n", handle, smb_fname_str_dbg(smb_fname))); + + if (smb_fname->stream_name) { + errno = ENOENT; + return result; + } + + result = ceph_statx(handle->data, smb_fname->base_name, &stx, + CEPH_STATX_BASIC_STATS|CEPH_STATX_BTIME, + AT_SYMLINK_NOFOLLOW); + DEBUG(10, ("[CEPH] lstat(...) = %d\n", result)); + if (result < 0) { + WRAP_RETURN(result); + } + init_stat_ex_from_ceph_statx(&smb_fname->st, &stx); + return result; +} + #else /* HAVE_CEPH_STATX */ static int cephwrap_stat(struct vfs_handle_struct *handle, @@ -683,7 +707,6 @@ static int cephwrap_fstat(struct vfs_handle_struct *handle, files_struct *fsp, S DEBUG(10, ("[CEPH] mode = 0x%x\n", sbuf->st_ex_mode)); return result; } -#endif /* HAVE_CEPH_STATX */ static int cephwrap_lstat(struct vfs_handle_struct *handle, struct smb_filename *smb_fname) @@ -708,6 +731,7 @@ static int cephwrap_lstat(struct vfs_handle_struct *handle, lp_fake_directory_create_times(SNUM(handle->conn))); return result; } +#endif /* HAVE_CEPH_STATX */ static int cephwrap_unlink(struct vfs_handle_struct *handle, const struct smb_filename *smb_fname)