@@ -314,14 +314,9 @@ int Scheduler::FlatSchedulerFileAccess(AccessArguments *args) {
314314 return EINVAL ;
315315 }
316316
317- placement::AccessArguments access_args {
318- *args->fsindex ,
319- args->inode ,
320- strategy,
321- args->vid ->geolocation ,
322- args->unavailfs ,
323- *args->locationsfs
324- };
317+ placement::AccessArguments access_args{*args->fsindex , args->inode ,
318+ strategy, args->vid ->geolocation ,
319+ args->unavailfs , *args->locationsfs };
325320
326321 return gOFS ->mFsScheduler ->access (spaceName, access_args);
327322}
@@ -352,51 +347,81 @@ int Scheduler::FileAccess(AccessArguments* args)
352347 return ENODATA ;
353348 }
354349
350+ int rc = 0 ;
351+
355352 if (!FlatSchedulerFileAccess (args)) {
356353 eos_static_debug (" msg=\" successfully accessed file via FlatScheduler\" index=%zu" ,
357354 *args->fsindex );
358- return 0 ;
359355 } else {
360356 eos_static_info (" %s" , " msg=\" Failed access via FlatScheduler, falling back to geotree\" " );
361- }
357+ eos_static_debug (" requesting file access from geolocation %s" ,
358+ args->vid ->geolocation .c_str ());
359+ GeoTreeEngine::SchedType st = toGeoTreeSchedtype (args->schedtype , args->isRW );
362360
363- eos_static_debug ( " requesting file access from geolocation %s " ,
364- args->vid -> geolocation . c_str ());
365- GeoTreeEngine::SchedType st = toGeoTreeSchedtype (args-> schedtype , args-> isRW ) ;
361+ // make sure we have the matching geo location before the not matching one
362+ if (! args->tried_cgi -> empty ()) {
363+ std::vector<std::string> hosts ;
366364
365+ if (!gOFS ->mGeoTreeEngine ->getInfosFromFsIds (*args->locationsfs , 0 , &hosts, 0 )) {
366+ eos_static_debug (" could not retrieve host for all the avoided fsids" );
367+ }
367368
368- // make sure we have the matching geo location before the not matching one
369- if (!args->tried_cgi ->empty ()) {
370- std::vector<std::string> hosts;
369+ size_t idx = 0 ;
371370
372- if (!gOFS ->mGeoTreeEngine ->getInfosFromFsIds (*args->locationsfs , 0 ,
373- &hosts, 0 )) {
374- eos_static_debug (" could not retrieve host for all the avoided fsids" );
371+ // we store unavailable filesystems in the unavail vector
372+ for (auto it = hosts.begin (); it != hosts.end (); it++) {
373+ if ((!it->empty ()) && args->tried_cgi ->find ((*it) + " ," ) != std::string::npos) {
374+ // - this matters for RAID layouts because we have to remove there URLs
375+ // to let the RAID driver use only online stripes
376+ args->unavailfs ->push_back ((*args->locationsfs )[idx]);
377+ }
378+
379+ idx++;
380+ }
375381 }
376382
377- size_t idx = 0 ;
383+ rc = gOFS ->mGeoTreeEngine ->accessHeadReplicaMultipleGroup (
384+ nReqStripes, *args->fsindex , *args->locationsfs , args->inode , args->dataproxys ,
385+ args->firewallentpts , st, args->vid ->geolocation , args->forcedfsid ,
386+ args->unavailfs );
387+ }
378388
379- // we store unavailable filesystems in the unavail vector
380- for (auto it = hosts.begin (); it != hosts.end (); it++) {
381- if ((!it->empty ()) && args->tried_cgi ->find ((*it) + " ," ) != std::string::npos) {
382- // - this matters for RAID layouts because we have to remove there URLs
383- // to let the RAID driver use only online stripes
384- args->unavailfs ->push_back ((*args->locationsfs )[idx]);
389+ // Honour the exclusion list: if the chosen file system is excluded, try to
390+ // find another suitable location that is neither excluded nor unavailable.
391+ // If no such location exists then the access request can not be satisfied.
392+ if (rc == 0 && args->exclude_filesystems && !args->exclude_filesystems ->empty () &&
393+ *args->fsindex < args->locationsfs ->size ()) {
394+ auto chosen = (*args->locationsfs )[*args->fsindex ];
395+ bool is_excluded =
396+ std::find (args->exclude_filesystems ->begin (), args->exclude_filesystems ->end (),
397+ chosen) != args->exclude_filesystems ->end ();
398+ if (is_excluded) {
399+ bool found = false ;
400+
401+ for (size_t i = 0 ; i < args->locationsfs ->size (); ++i) {
402+ auto fsid = (*args->locationsfs )[i];
403+ bool excluded = std::find (args->exclude_filesystems ->begin (),
404+ args->exclude_filesystems ->end (),
405+ fsid) != args->exclude_filesystems ->end ();
406+ bool unavail =
407+ args->unavailfs && std::find (args->unavailfs ->begin (), args->unavailfs ->end (),
408+ fsid) != args->unavailfs ->end ();
409+ if (!excluded && !unavail) {
410+ *args->fsindex = i;
411+ found = true ;
412+ break ;
413+ }
385414 }
386415
387- idx++;
416+ if (!found) {
417+ eos_static_err (" %s" , " msg=\" no accessible file system location left after "
418+ " applying the eos.excludefsid exclusion list\" " );
419+ rc = ENODATA ;
420+ }
388421 }
389422 }
390423
391- return gOFS ->mGeoTreeEngine ->accessHeadReplicaMultipleGroup (nReqStripes,
392- *args->fsindex ,
393- *args->locationsfs ,
394- args->inode ,
395- args->dataproxys ,
396- args->firewallentpts ,
397- st,
398- args->vid ->geolocation ,
399- args->forcedfsid , args->unavailfs );
424+ return rc;
400425}
401426
402427void Scheduler::ReshuffleFs (std::vector<unsigned int > &selectedfs)
0 commit comments