Merge tag 'pci-v5.18-changes-2' of git://git.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / tools / perf / util / symbol.c
index dfde9eada224afd31d81842054b108ea576873f2..dea0fc495185daac9db744e9832895171e3206b7 100644 (file)
@@ -1735,8 +1735,8 @@ static int dso__find_perf_map(char *filebuf, size_t bufsz,
 
        nsi = *nsip;
 
-       if (nsi->need_setns) {
-               snprintf(filebuf, bufsz, "/tmp/perf-%d.map", nsi->nstgid);
+       if (nsinfo__need_setns(nsi)) {
+               snprintf(filebuf, bufsz, "/tmp/perf-%d.map", nsinfo__nstgid(nsi));
                nsinfo__mountns_enter(nsi, &nsc);
                rc = access(filebuf, R_OK);
                nsinfo__mountns_exit(&nsc);
@@ -1748,8 +1748,8 @@ static int dso__find_perf_map(char *filebuf, size_t bufsz,
        if (nnsi) {
                nsinfo__put(nsi);
 
-               nnsi->need_setns = false;
-               snprintf(filebuf, bufsz, "/tmp/perf-%d.map", nnsi->tgid);
+               nsinfo__clear_need_setns(nnsi);
+               snprintf(filebuf, bufsz, "/tmp/perf-%d.map", nsinfo__tgid(nnsi));
                *nsip = nnsi;
                rc = 0;
        }
@@ -1864,6 +1864,16 @@ int dso__load(struct dso *dso, struct map *map)
                        nsinfo__mountns_exit(&nsc);
 
                is_reg = is_regular_file(name);
+               if (!is_reg && errno == ENOENT && dso->nsinfo) {
+                       char *new_name = filename_with_chroot(dso->nsinfo->pid,
+                                                             name);
+                       if (new_name) {
+                               is_reg = is_regular_file(new_name);
+                               strlcpy(name, new_name, PATH_MAX);
+                               free(new_name);
+                       }
+               }
+
 #ifdef HAVE_LIBBFD_SUPPORT
                if (is_reg)
                        bfdrc = dso__load_bfd_symbols(dso, name);