DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Mohakud, Amiya Ranjan" <amohakud@rbbn.com>
To: dpdk-dev <dev@dpdk.org>
Cc: "Mohakud, Amiya Ranjan" <amohakud@rbbn.com>
Subject: [dpdk-dev] eal: DPDK: 18.11.6 version rte_eal_init() function cleans the runtime directory in 5.4.35 kernel
Date: Thu, 15 Oct 2020 13:26:53 +0000	[thread overview]
Message-ID: <DM6PR03MB3547EC4B79D729E897B08713B9020@DM6PR03MB3547.namprd03.prod.outlook.com> (raw)
In-Reply-To: <DM6PR03MB3547EDC8BAAD1DA17AE4470EB9020@DM6PR03MB3547.namprd03.prod.outlook.com>

Hi All,
I'm facing one issue with DPDK-18.11.6 in EAL library. Please find the below problem statement.

Problem Statement:
I have one DPDK application using DPDK version 18.11.6 which works fine in 4.19 version kernel. The rte_eal_init() works fine and eal_clean_runtime_dir() does not remove the files present in dpdk run time directory, /var/run/dpdk/rte/.
The same application when I am trying to run in 5.4.35 kernel, the rte_eal_init() behavior is different. eal_clean_runtime_dir()  cleans up dpdk run time directory, as a result the secondary processes fail to come up. Basically the flock system call succeeds , return value is 0 which goes and deletes the files. And in 4.19 kernel the flcok system call fails.

Note: This is the case with 5.3 kernel version .

int
eal_clean_runtime_dir(void)
{
       DIR *dir;
       struct dirent *dirent;
       int dir_fd, fd, lck_result;
       static const char * const filters[] = {
              "fbarray_*",
              "mp_socket_*"
       };
       /* open directory */
       dir = opendir(runtime_dir);
       if (!dir) {
              RTE_LOG(ERR, EAL, "Unable to open runtime directory %s\n",
                           runtime_dir);
              goto error;
       }
       dir_fd = dirfd(dir);

       /* lock the directory before doing anything, to avoid races */
       if (flock(dir_fd, LOCK_EX) < 0) {
              RTE_LOG(ERR, EAL, "Unable to lock runtime directory %s\n",
                     runtime_dir);
              goto error;
       }

       dirent = readdir(dir);
       if (!dirent) {
              RTE_LOG(ERR, EAL, "Unable to read runtime directory %s\n",
                           runtime_dir);
              goto error;
       }

       while (dirent != NULL) {
              unsigned int f_idx;
              bool skip = true;

              /* skip files that don't match the patterns */
              for (f_idx = 0; f_idx < RTE_DIM(filters); f_idx++) {
                     const char *filter = filters[f_idx];

                     if (fnmatch(filter, dirent->d_name, 0) == 0) {
                           skip = false;
                           break;
                     }
              }
              if (skip) {
                     dirent = readdir(dir);
                     continue;
              }

              /* try and lock the file */
              fd = openat(dir_fd, dirent->d_name, O_RDONLY);

              /* skip to next file */
              if (fd == -1) {
                     dirent = readdir(dir);
                     continue;
              }

              /* non-blocking lock */
              lck_result = flock(fd, LOCK_EX | LOCK_NB);

              /* if lock succeeds, remove the file */
              if (lck_result != -1)
                     unlinkat(dir_fd, dirent->d_name, 0);
              close(fd);
              dirent = readdir(dir);
       }

       /* closedir closes dir_fd and drops the lock */
       closedir(dir);
       return 0;

error:
       if (dir)
              closedir(dir);
       RTE_LOG(ERR, EAL, "Error while clearing runtime dir: %s\n",
              strerror(errno));

       return -1;
}

Could anybody please help me know, if there is any patch related to this or any way to solve this issue?

Thanks in advance.

Regards
Amiya

       reply	other threads:[~2020-10-15 13:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <DM6PR03MB3547EDC8BAAD1DA17AE4470EB9020@DM6PR03MB3547.namprd03.prod.outlook.com>
2020-10-15 13:26 ` Mohakud, Amiya Ranjan [this message]
2020-10-15 13:52   ` Burakov, Anatoly
2020-10-15 14:43     ` Mohakud, Amiya Ranjan
2020-10-15 15:08       ` Burakov, Anatoly
2020-10-15 16:07         ` Mohakud, Amiya Ranjan
2020-10-15 16:14           ` Mohakud, Amiya Ranjan
2020-10-15 18:01             ` Burakov, Anatoly
2020-10-15 18:34               ` Burakov, Anatoly
2020-10-16  5:34                 ` Mohakud, Amiya Ranjan
2020-10-22  7:12                   ` Mohakud, Amiya Ranjan
     [not found]                     ` <DM6PR03MB3547C263D4E20B3DD124AD43B91D0@DM6PR03MB3547.namprd03.prod.outlook.com>
2020-10-28  7:00                       ` Mohakud, Amiya Ranjan
2020-10-29 15:51                         ` Burakov, Anatoly
2020-10-29 17:10                           ` Burakov, Anatoly
2020-10-29 17:40                             ` Mohakud, Amiya Ranjan
2020-10-30 10:00                               ` Burakov, Anatoly
2021-01-04  7:53                                 ` Mohakud, Amiya Ranjan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DM6PR03MB3547EC4B79D729E897B08713B9020@DM6PR03MB3547.namprd03.prod.outlook.com \
    --to=amohakud@rbbn.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).