Skip to content

Commit

Permalink
Merge pull request #16409 from dan131riley/LocalFileSystem-prefer-local
Browse files Browse the repository at this point in the history
Fix lazy-download handling of file systems that are mounted more than once
  • Loading branch information
cmsbuild authored Nov 1, 2016
2 parents 585dcfa + f6eaecd commit 51edd2c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Utilities/StorageFactory/src/LocalFileSystem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,17 @@ LocalFileSystem::findMount(const char *path, struct statfs *sfs, struct stat *s,
{
// First match simply against the file system path. We don't
// touch the file system until the path prefix matches.
// When we have a path prefix match, check the file system if
// we don't have a best match candidate yet, OR
// this match is longer (more specific) than the previous best OR
// this match is the same length and the previous best isn't local
// The final condition handles cases such as '/' that can appear twice
// in the file system list, once as 'rootfs' and once as local fs.
size_t fslen = strlen(fs_[i]->dir);
if (! strncmp(fs_[i]->dir, path, fslen)
&& ((fslen == 1 && fs_[i]->dir[0] == '/')
|| len == fslen || path[fslen] == '/')
&& (! best || fslen > bestlen))
&& (! best || fslen > bestlen || (fslen == bestlen && !best->local)))
{
// Get the file system device and file system ids.
if (statFSInfo(fs_[i]) < 0)
Expand Down

0 comments on commit 51edd2c

Please sign in to comment.