I don't see anything that protects against that. However, the correct
solution is to switch to support_ex (which needs to be done anyway to
move to 2.6 or later), which doesn't have this problem.
Daniel
On 08/09/2018 10:34 AM, Sagar M D wrote:
Daniel,
in stable 2.5 ganesha code, i see this in fsal_rdwr function:
loflags
<
http://localhost:8080/source/xref/nfs-ganesha-2.5-stable/src/FSAL/fsal_he...
= obj
<
http://localhost:8080/source/s?defs=obj&project=nfs-ganesha-2.5-stabl...
<
http://localhost:8080/source/s?defs=obj_ops&project=nfs-ganesha-2.5-s...
<
http://localhost:8080/source/s?defs=status&project=nfs-ganesha-2.5-st...
<
http://localhost:8080/source/s?defs=obj&project=nfs-ganesha-2.5-stable>);
*while* ((!fsal_is_open
<
http://localhost:8080/source/xref/nfs-ganesha-2.5-stable/src/FSAL/fsal_he...
<
http://localhost:8080/source/s?defs=obj&project=nfs-ganesha-2.5-stabl...
|| (loflags
<
http://localhost:8080/source/xref/nfs-ganesha-2.5-stable/src/FSAL/fsal_he...
&& loflags
<
http://localhost:8080/source/xref/nfs-ganesha-2.5-stable/src/FSAL/fsal_he...
!= FSAL_O_RDWR
<
http://localhost:8080/source/s?defs=FSAL_O_RDWR&project=nfs-ganesha-2...
&& loflags
<
http://localhost:8080/source/xref/nfs-ganesha-2.5-stable/src/FSAL/fsal_he...
!= openflags
<
http://localhost:8080/source/s?defs=openflags&project=nfs-ganesha-2.5...
{ loflags
<
http://localhost:8080/source/xref/nfs-ganesha-2.5-stable/src/FSAL/fsal_he...
= obj
<
http://localhost:8080/source/s?defs=obj&project=nfs-ganesha-2.5-stabl...
<
http://localhost:8080/source/s?defs=obj_ops&project=nfs-ganesha-2.5-s...
<
http://localhost:8080/source/s?defs=status&project=nfs-ganesha-2.5-st...
<
http://localhost:8080/source/s?defs=obj&project=nfs-ganesha-2.5-stable>);
*if* ((!fsal_is_open
<
http://localhost:8080/source/xref/nfs-ganesha-2.5-stable/src/FSAL/fsal_he...
<
http://localhost:8080/source/s?defs=obj&project=nfs-ganesha-2.5-stabl...
|| (loflags
<
http://localhost:8080/source/xref/nfs-ganesha-2.5-stable/src/FSAL/fsal_he...
&& loflags
<
http://localhost:8080/source/xref/nfs-ganesha-2.5-stable/src/FSAL/fsal_he...
!= FSAL_O_RDWR
<
http://localhost:8080/source/s?defs=FSAL_O_RDWR&project=nfs-ganesha-2...
&& loflags
<
http://localhost:8080/source/xref/nfs-ganesha-2.5-stable/src/FSAL/fsal_he...
!= openflags
<
http://localhost:8080/source/s?defs=openflags&project=nfs-ganesha-2.5...
{ fsal_status
<
http://localhost:8080/source/s?defs=fsal_status&project=nfs-ganesha-2...
= fsal_open
<
http://localhost:8080/source/xref/nfs-ganesha-2.5-stable/src/FSAL/fsal_he...
<
http://localhost:8080/source/s?defs=obj&project=nfs-ganesha-2.5-stabl...;,
openflags
<
http://localhost:8080/source/s?defs=openflags&project=nfs-ganesha-2.5...>);
*if* (FSAL_IS_ERROR
<
http://localhost:8080/source/s?defs=FSAL_IS_ERROR&project=nfs-ganesha...
<
http://localhost:8080/source/s?defs=fsal_status&project=nfs-ganesha-2...
*goto* out
<
http://localhost:8080/source/s?defs=out&project=nfs-ganesha-2.5-stable>;
opened
<
http://localhost:8080/source/s?defs=opened&project=nfs-ganesha-2.5-st...
= *true*; } loflags
<
http://localhost:8080/source/xref/nfs-ganesha-2.5-stable/src/FSAL/fsal_he...
= obj
<
http://localhost:8080/source/s?defs=obj&project=nfs-ganesha-2.5-stabl...
<
http://localhost:8080/source/s?defs=obj_ops&project=nfs-ganesha-2.5-s...
<
http://localhost:8080/source/s?defs=status&project=nfs-ganesha-2.5-st...
<
http://localhost:8080/source/s?defs=obj&project=nfs-ganesha-2.5-stable>); }
......
......
......
*if* (opened
<
http://localhost:8080/source/s?defs=opened&project=nfs-ganesha-2.5-st...>)
{ fsal_status
<
http://localhost:8080/source/s?defs=fsal_status&project=nfs-ganesha-2...
= obj
<
http://localhost:8080/source/s?defs=obj&project=nfs-ganesha-2.5-stabl...
<
http://localhost:8080/source/s?defs=obj_ops&project=nfs-ganesha-2.5-s...
<
http://localhost:8080/source/s?defs=close&project=nfs-ganesha-2.5-sta...
<
http://localhost:8080/source/s?defs=obj&project=nfs-ganesha-2.5-stable>);
*if* (FSAL_IS_ERROR
<
http://localhost:8080/source/s?defs=FSAL_IS_ERROR&project=nfs-ganesha...
<
http://localhost:8080/source/s?defs=fsal_status&project=nfs-ganesha-2...
{ LogEvent
<
http://localhost:8080/source/s?defs=LogEvent&project=nfs-ganesha-2.5-...
<
http://localhost:8080/source/s?defs=COMPONENT_FSAL&project=nfs-ganesh...;,
"fsal_rdwr_plus: close = %s", fsal_err_txt
<
http://localhost:8080/source/s?defs=fsal_err_txt&project=nfs-ganesha-...
<
http://localhost:8080/source/s?defs=fsal_status&project=nfs-ganesha-2...;
*goto* out
<
http://localhost:8080/source/s?defs=out&project=nfs-ganesha-2.5-stable>; }
}
Here multiple thread can come into this function and call fsal_is_open
function. For example
T1 thread opens it and sets opened flag to true.
T2 will see that ,it already opened . continue withour calling fsal_open.
T1 finishes the r/w operation and close the file.
T2 is now trying to work on closed fd.
is this situation can arise from above code ? is Ganesha expects some
reference count for open file fd inside fsal here ?
Thanks,
Sagar.
On Mon, Aug 6, 2018 at 11:07 PM, Daniel Gryniewicz <dang(a)redhat.com
<mailto:dang@redhat.com>> wrote:
Okay, so there are a few places where files are unconditionally
closed, regardless of whether or not they were open to begin with.
The FSAL would return ERR_FSAL_NOT_OPENED, but the caller would
ignore the error, since all it wanted to do was ensure the global FD
was closed. Examples of this are:
On remove
When we're recycling a handle
When a handle transitions from L1 to L2 of the LRU
My guess is that the last case is the one you're hitting. If the
file is in use, and very few handles are in use, then the handle
will transition back and forth across the L1/L2 border. Since you
haven't implemented open()/close() in your FSAL, the status() op
can't tell the handle was closed, so it might not open() again, if
it thought it was open already.
Daniel
On 08/06/2018 11:15 AM, You Me wrote:
Ganesha 2.5.1.
06/08/2018 10:51:18 : epoch 5b685fb2 : rhelindex :
ganesha.nfsd-41167[work-195] file_open :FSAL :CRIT :file_open()
fd = 1533189746
06/08/2018 10:51:18 : epoch 5b685fb2 : rhelindex :
ganesha.nfsd-41167[work-193] file_close :FSAL :CRIT
:file_close() fd = 1533189746
06/08/2018 10:51:18 : epoch 5b685fb2 : rhelindex :
ganesha.nfsd-41167[work-191] file_close :FSAL :CRIT
:file_close() fd = 1533189746
06/08/2018 10:51:18 : epoch 5b685fb2 : rhelindex :
ganesha.nfsd-41167[work-196] file_close :FSAL :CRIT
:file_close() fd = 1533189746
06/08/2018 10:51:18 : epoch 5b685fb2 : rhelindex :
ganesha.nfsd-41167[work-195] file_close :FSAL :CRIT
:file_close() fd = 1533189746
06/08/2018 10:51:18 : epoch 5b685fb2 : rhelindex :
ganesha.nfsd-41167[work-197] file_close :FSAL :CRIT
:file_close() fd = 1533189746
There was a read between open and first close.
Is this a known issue in that version of ganesha?
--Satish
On Mon, Aug 6, 2018 at 8:35 AM, Daniel Gryniewicz
<dang(a)redhat.com <mailto:dang@redhat.com>
<mailto:dang@redhat.com <mailto:dang@redhat.com>>> wrote:
No, there should be a single close for each open. There may be
multiple opens, but only a single close for each open.
Which version of Ganesha?
Daniel
On 08/03/2018 10:01 PM, You Me wrote:
When I write a lot of data to an NFS share using NFSv3
clients,
I see that Nfs-Ganesha opens file once but calls close
on same
FD multiple times.
What is the reason behind that?
—You
_______________________________________________
Devel mailing list -- devel(a)lists.nfs-ganesha.org
<mailto:devel@lists.nfs-ganesha.org>
<mailto:devel@lists.nfs-ganesha.org
<mailto:devel@lists.nfs-ganesha.org>>
To unsubscribe send an email to
devel-leave(a)lists.nfs-ganesha.org
<mailto:devel-leave@lists.nfs-ganesha.org>
<mailto:devel-leave@lists.nfs-ganesha.org
<mailto:devel-leave@lists.nfs-ganesha.org>>
_______________________________________________
Devel mailing list -- devel(a)lists.nfs-ganesha.org
<mailto:devel@lists.nfs-ganesha.org>
<mailto:devel@lists.nfs-ganesha.org
<mailto:devel@lists.nfs-ganesha.org>>
To unsubscribe send an email to
devel-leave(a)lists.nfs-ganesha.org
<mailto:devel-leave@lists.nfs-ganesha.org>
<mailto:devel-leave@lists.nfs-ganesha.org
<mailto:devel-leave@lists.nfs-ganesha.org>>
_______________________________________________
Devel mailing list -- devel(a)lists.nfs-ganesha.org
<mailto:devel@lists.nfs-ganesha.org>
To unsubscribe send an email to devel-leave(a)lists.nfs-ganesha.org
<mailto:devel-leave@lists.nfs-ganesha.org>