All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dilger, Andreas <andreas.dilger@intel.com>
To: lustre-devel@lists.lustre.org
Subject: [lustre-devel] [lustre-discuss] more on lustre striping
Date: Fri, 17 Jun 2016 18:28:51 +0000	[thread overview]
Message-ID: <444B216F-8A15-4D1D-AED6-9387D4EC0515@intel.com> (raw)
In-Reply-To: <8a9e4e45-ea99-1147-5c58-94a73d9010a8@iodoctors.com>

If I recall correctly from when we implemented liblustre, which hooked into userspace using LD_PRELOAD, we had to capture the __open() call instead of open() (or something similar) to ensure that glibc didn't bypass our LD_PRELOAD from inside of fopen().

You might consider downloading the source for glibc to see what it is doing in fopen().

Cheers, Andreas
--
Andreas Dilger
Lustre Principal Architect
Intel High Performance Data Division

On 2016/06/10, 10:04, "lustre-discuss on behalf of John Bauer" <lustre-discuss-bounces at lists.lustre.org<mailto:lustre-discuss-bounces@lists.lustre.org> on behalf of bauerj at iodoctors.com<mailto:bauerj@iodoctors.com>> wrote:


To confirm the point that you can not intercept the open called by fopen by using LD_PRELOAD, I have written a simple test case.  Note that the runtime linker never looks for open().  Only fopen()

$ cat a.c
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <stdio.h>

int
main(int argc, char ** argv ){
   FILE *f = fopen("a", "r" ) ;
   fprintf(stderr,"f=%p\n",f);
   fclose(f);
}
$ file a
a: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=dfe043b4ec8cf19d5fd3fab524d7c72ed1453574, not stripped
$ cat a.csh
#!/bin/csh
setenv LD_DEBUG all
./a >&! a.cpr
$ ./a.csh
$ grep -i open a.cpr
    120584:     symbol=fopen;  lookup in file=./a [0]
    120584:     symbol=fopen;  lookup in file=/lib64/libc.so.6 [0]
    120584:     binding file ./a [0] to /lib64/libc.so.6 [0]: normal symbol `fopen' [GLIBC_2.2.5]
$

On 6/10/2016 7:29 AM, Ashley Pittman wrote:
On 22/05/16 02:56, John Bauer wrote:

Oleg

I can intercept the fopen(), but that does me no good as I can't set the O_LOV_DELAY_CREATE bit.  What I can not intercept is the open() downstream of fopen().  If one examines the symbols in libc you will see there are no unsatisfied externals relating to open, which means there is nothing for the runtime linker to find concerning open's.  I will have a look at the Lustre 1.8 source, but I seriously doubt that the open beneath fopen() was intercepted with LD_PRELOAD.  I would love to find a way to do that.  I could throw away a lot of code. Thanks,  John

Could you not intercept fopen() and implement it with calls to open() and fdopen() yourself which would give you full control over what you're looking for here?

Ashley.



--

I/O Doctors, LLC

507-766-0378

bauerj at iodoctors.com<mailto:bauerj@iodoctors.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20160617/fe11079b/attachment.htm>

  reply	other threads:[~2016-06-17 18:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1ef5a267-334c-be0d-13f4-c0fab917d1bf@iodoctors.com>
2016-05-21  5:51 ` [lustre-devel] [lustre-discuss] more on lustre striping Dilger, Andreas
2016-05-21 20:01   ` John Bauer
2016-05-21 20:08     ` Drokin, Oleg
2016-05-21 20:25       ` John Bauer
2016-05-22  0:33         ` Drokin, Oleg
2016-05-22  1:56           ` John Bauer
2016-05-22  2:49             ` Drokin, Oleg
2016-06-10 12:29             ` Ashley Pittman
2016-06-10 15:28               ` John Bauer
2016-06-10 16:04               ` John Bauer
2016-06-17 18:28                 ` Dilger, Andreas [this message]
2016-06-23 21:50                 ` Oleg Drokin
2016-06-26 19:17                   ` John Bauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=444B216F-8A15-4D1D-AED6-9387D4EC0515@intel.com \
    --to=andreas.dilger@intel.com \
    --cc=lustre-devel@lists.lustre.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.