Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3454630
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:30:58+00:00 2026-05-18T09:30:58+00:00

I’m writing a FUSE filesystem that does some mapping through sqlite, then passes the

  • 0

I’m writing a FUSE filesystem that does some mapping through sqlite, then passes the calls through to the underlying filesystem (somewhat of an expansion on bbfs). It started giving me trouble when I tried to start making files. When I call mknod, it returns with ERANGE. Here’s the tail of an strace (filesystem is mounted on test/):

$ ./p4fs test/
$ strace touch test/kilo 2> logs
$ cat logs
...
fstat(3, {st_mode=S_IFREG|0644, st_size=56467024, ...}) = 0
mmap(NULL, 56467024, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fbf006bf000
close(3)                                = 0
close(0)                                = 0
open("test/kilo", O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK, 0666) = -1 ERANGE (Numerical result out of range)
futimesat(AT_FDCWD, "test/kilo", NULL)  = 0
close(1)                                = 0
exit_group(0)                           = ?

and here’s the relevant section from my internal logging:

getattr: database opened
getattr: requesting attr for /kilo
db_getrowid: statement executed: finding rowid of /kilo
db_getrowid: mapped /kilo to rowid 0
getattr: does not exist: /kilo
mknod: database opened
mknod: statement executed: checking for existing path
mknod: calling db_mkdentry(db, /kilo, 100644, 0, 0)
db_mkdentry: parent is /
db_getrowid: statement executed: finding rowid of /
db_getrowid: mapped / to rowid 1
db_mkdentry: statement executed: creating dentry /kilo
db_getrowid: statement executed: finding rowid of /kilo
db_getrowid: mapped /kilo to rowid 3
p4fs: calling system mknod(3, 100644, 0)
p4fs: got errno 13

I’m looking for (1) the solution to this immediate problem and (2) a good way to debug FUSE in general. I have a sneaking suspicion that the ERANGE is coming from strtol(), but I don’t know how to check. I wish I could make gdb pop up when it hits the callback…

Thanks!

EDIT: Oh, here’s the source for my mknod() function:

static int p4_mknod(const char *path, mode_t mode, dev_t dev) {
        sqlite3 *db;
        sqlite3_stmt *statement;
        char query[MAX_QUERY_LENGTH];
        int rc;
        int return_value;
        int path_exists = -1;

        OPEN_LOG("mknod")
        OPEN_DB(db_path, db)

        /* check for existing filename */
        sprintf(query,
                "SELECT COUNT(*) FROM dentry "
                "WHERE name = '%s'",
                path);
        sqlite3_prepare(db,
                query,
                -1,
                &statement,
                NULL);
        rc = sqlite3_step(statement);
        SQLITE3_ERRCHK("checking for existing path")
        path_exists = sqlite3_column_int(statement, 0);
        sqlite3_finalize(statement);

        if (path_exists <= 0) {
                int physical_rowid;
                char physical_name[MAX_QUERY_LENGTH];

                /* path is not already in db */
                syslog(LOG_DEBUG, "calling db_mkdentry(db, %s, %o, 0, 0)",
                        path, mode);
                db_mkdentry(db, (char *) path, mode, 0, 0);

                /* make the actual file */
                physical_rowid = db_getrowid(db, (char *) path);
                sprintf(physical_name, "%i", physical_rowid);
                syslog(LOG_DEBUG, "calling system mknod(%s, %o, %li)",
                        physical_name, mode, dev);
                return_value = mknod(physical_name, mode, dev);
        } else {
                syslog(LOG_INFO, "called on existing path");
                return_value = -EEXIST;
        }

        syslog(LOG_DEBUG, "errno %i", errno);

        return errno;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T09:30:58+00:00Added an answer on May 18, 2026 at 9:30 am

    It’s not really an answer, but I got around the issue by running as root. I suspect it has something to do with FUSE, because I had a similar issue when trying to get sshfs to run as a normal user a few months ago.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.