From: ericm Date: Tue, 25 Nov 2003 14:43:38 +0000 (+0000) Subject: liblustre: as andreas pointed out, open() need to convert O_XXX flags X-Git-Tag: v1_7_0_51~2^7~188 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=45c1ac01e06e5564487d6aa236567a173cd8d80c;p=fs%2Flustre-release.git liblustre: as andreas pointed out, open() need to convert O_XXX flags to FMODE_XXX which is internally used by lustre. remove the original hacking code. --- diff --git a/lustre/liblustre/namei.c b/lustre/liblustre/namei.c index 3ac2399..1dceb8b 100644 --- a/lustre/liblustre/namei.c +++ b/lustre/liblustre/namei.c @@ -509,6 +509,7 @@ static struct lookup_intent* translate_lookup_intent(struct intent *intent, const char *path) { struct lookup_intent *it; + int fmode; /* libsysio trick */ if (!intent || path) { @@ -538,20 +539,20 @@ translate_lookup_intent(struct intent *intent, const char *path) it->it_flags = intent->int_arg2 ? *((int*)intent->int_arg2) : 0; - /* FIXME when use open(O_WRONLY) to create a file, MDS will - * delay the object creation on OST, thus no lsm will be returned. - * if call write() at the time, ll_extent_lock() will failed out - * because there will be no strip MD supplied. but O_RDWR will - * work fine. Here we forcely set the O_RDWR in this case, find - * a real fix later! FIXME - */ - if (it->it_flags & O_WRONLY) { - it->it_flags &= ~O_WRONLY; - it->it_flags |= O_RDWR; + if (intent->int_opmask & INT_OPEN) { + it->it_op |= IT_OPEN; + + /* convert access mode from O_ to FMODE_ */ + if (it->it_flags & O_WRONLY) + fmode = FMODE_WRITE; + else if (it->it_flags & O_RDWR) + fmode = FMODE_READ | FMODE_WRITE; + else + fmode = FMODE_READ; + it->it_flags &= ~O_ACCMODE; + it->it_flags |= fmode; } - if (intent->int_opmask & INT_OPEN) - it->it_op |= IT_OPEN; /* else if (intent->int_opmask & INT_CREAT) it->it_op |= IT_LOOKUP;