[Filesystem] Fix regression introduced in 10dea94

This is one of ideas to fix the regression from 10dea948, @kachkaev what do you think?

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature? | no
| Tests pass?  | yes
| Fixed tickets | #7920
| License       | MIT