readdir failing in symlink into a CIFS mount

Issues related to applications and software problems
Post Reply
JohnGalt131
Posts: 3
Joined: 2017/08/22 12:08:14

readdir failing in symlink into a CIFS mount

Post by JohnGalt131 » 2017/08/22 12:27:23

I have a mountpoint

/opt/dirName

Then (for legacy reasons) there's a symbolic link

/usr/oper -> /opt/dirName/share/oper

I have some old code that is calling readdir to get the contents of the directory /usr/oper/config/cv. readdir returns "." which is ignored, and then the next call (which should be 00_00.col) returns NULL (indicating there are no more files). As a test, I ripped that directory parsing code out and put it in a simple standalone application that did nothing but print the name of the files. Interestingly, that works. In the main application, it fails. Looking at the syslog, I see [kernel: CIFS VFS: Filldir for parent dir failed].

When I put the trivial code that only searches the directory and prints the names just before the main application's code, *it* fails as well. However, I then changed the /usr/oper/... path to the equivalent directory in /opt/dirName/share/oper/config/cv and then the trivial printing loop worked in the main application where it had failed before.

Unfortunately, there's a lot of risk in changing all the paths from /usr/oper to /opt/dirName/share/oper and it would need to be done in half a dozen or more applications. Also, that path is likely in several configuration files.

I also tried
rsync /opt/dirName /opt/dirName2

and changed the symlink to point to the path which exists on the local disk (dirName2) instead of the cifs mount point (dirName) and then *all* the code that parses the /usr/oper/... directories worked.



I had a couple of theories, but my tests debunk them.

Theory 1) System limitation (too many descriptors of some sort)
Debunked By) Changing the path from /usr/oper/... to /opt/dirName/share/oper/... seems to fix the issue

Theory 2) RHEL security settings preclude this type of access or bug in CIFS.
Debunked By) I can build a standalone application which *is* able to do the same thing from the same working directory

All of this code previously worked on an older version of OpenSuSE; I just recently migrated to CENT7 and it has broken.


Anyone have any idea what the problem is

JohnGalt131
Posts: 3
Joined: 2017/08/22 12:08:14

Re: readdir failing in symlink into a CIFS mount

Post by JohnGalt131 » 2017/08/22 15:41:52

UPDATE:

I found that this problem is reproducible when compiling that standalone application with -m32, but works without that.

JohnGalt131
Posts: 3
Joined: 2017/08/22 12:08:14

Re: readdir failing in symlink into a CIFS mount

Post by JohnGalt131 » 2017/08/22 16:50:31

errno is set to 12 (ENOMEM) when readdir fails.

Post Reply