Repository: iterative/dvc

Issue:
`dvc exp run` does not work on nfs mounted share
# Bug Report

<!--
## Issue name

Issue names must follow the pattern `command: description` where the command is the dvc command that you are trying to run. The description should describe the consequence of the bug. 

Example: `repro: doesn't detect input changes`
-->

## Description

<!--
A clear and concise description of what the bug is.
-->

When trying to run an experiment on an nfs mounted share with `core.hardlink_lock = True`, the command fails with:

```
ERROR: Unable to acquire lock. Most likely another DVC process is running or was terminated abruptly. Check the page <https://dvc.org/doc/user-guide/troubleshooting#lock-issue> for other possible reasons and to learn how to resolve this.
```

### Reproduce

<!--
Step list of how to reproduce the bug
-->

<!--
Example:

1. dvc init
2. Copy dataset.zip to the directory
3. dvc add dataset.zip
4. dvc run -d dataset.zip -o model ./train.sh
5. modify dataset.zip
6. dvc repro
-->

on an nfs mounted share:

1. mkdir test
2. git init .
3. dvc init
4. dvc config core.hardlink_lock true
4. touch a.txt
5. dvc stage add -n cp -d a.txt -o b.txt cp a.txt b.txt
6. dvc repro
7. git add .
8. git commit -m "Initial commit"
9. dvc exp run

results in:

```
ERROR: Unable to acquire lock. Most likely another DVC process is running or was terminated abruptly. Check the page <https://dvc.org/doc/user-guide/troubleshooting#lock-issue> for other possible reasons and to learn how to resolve this.
```

### Expected

<!--
A clear and concise description of what you expect to happen.
-->

The experiment should succeed

### Environment information

<!--
This is required to ensure that we can reproduce the bug.
-->

**Output of `dvc doctor`:**

```console
$ dvc doctor
DVC version: 2.8.3 (conda)
---------------------------------
Platform: Python 3.9.7 on Linux-4.15.0-143-generic-x86_64-with-glibc2.27
Supports:
        webhdfs (fsspec = 2021.11.0),
        http (aiohttp = 3.8.1, aiohttp-retry = 2.4.6),
        https (aiohttp = 3.8.1, aiohttp-retry = 2.4.6),
        ssh (sshfs = 2021.11.2)
```

**Additional Information (if any):**

<!--
Please check https://github.com/iterative/dvc/wiki/Debugging-DVC on ways to gather more information regarding the issue.

If applicable, please also provide a `--verbose` output of the command, eg: `dvc add --verbose`.
If the issue is regarding the performance, please attach the profiling information and the benchmark comparisons.
-->

`dvc repro` works.

I've checked https://github.com/iterative/dvc/blob/master/dvc/repo/experiments/__init__.py#L98-L101 and it does not seem to check for the setting `core.hardlink_lock` when creating a lock


Discussion:

Resolving patch:
diff --git a/dvc/repo/experiments/__init__.py b/dvc/repo/experiments/__init__.py
--- a/dvc/repo/experiments/__init__.py
+++ b/dvc/repo/experiments/__init__.py
@@ -98,6 +98,7 @@ def __init__(self, repo):
         self.scm_lock = make_lock(
             os.path.join(self.repo.tmp_dir, "exp_scm_lock"),
             tmp_dir=self.repo.tmp_dir,
+            hardlink_lock=repo.config["core"].get("hardlink_lock", False),
         )
 
     @property


Test patch: