xfs
[Top] [All Lists]

Re: [PATCH] xfs_quota: correctly initialise the default path

To: Dave Chinner <david@xxxxxxxxxxxxx>
Subject: Re: [PATCH] xfs_quota: correctly initialise the default path
From: Mark Tinguely <tinguely@xxxxxxx>
Date: Sat, 17 Nov 2012 15:15:25 -0600
Cc: xfs@xxxxxxxxxxx
In-reply-to: <1353028488-24436-1-git-send-email-david@xxxxxxxxxxxxx>
References: <1353028488-24436-1-git-send-email-david@xxxxxxxxxxxxx>
User-agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20120122 Thunderbird/9.0
On 11/15/12 19:14, Dave Chinner wrote:
From: Dave Chinner<dchinner@xxxxxxxxxx>

When we initial xfs_quota, we place lots of information into the
fs_table. This includes all the devices/mount points the user has
specified as a global command line parameter to report on, as well
as all the paths under project quota control.

There is a "current path" pointer (fs_path) maintained by the code
that points somewhere into the fs_table. After the table is
initialised, fs_path always points to the last entry in the table,
and hence has to be re-initialised to point at the desired entry
before it can be used properly.

...

fun code read :)

        init_commands();
        add_args_command(init_args_command);
+
+       /*
+        * Ensure that global commands don't end up with an invalid path pointer
+        * by setting the default device at the first specified on the CLI
+        */
+       if (argc != optind)
+               fs_path = fs_table_lookup(argv[optind], FS_MOUNT_POINT);

fs_table_lookup() can return NULL - especially the way I type.


--Mark.

<Prev in Thread] Current Thread [Next in Thread>